I have a c++ program which opens an url depending in what the user inputs.
Here's the code:
#include <iostream>
#include <string>
using namespace std;
int main(){
int i = 1;
string google = "https://www.google.com/search?q=";
string input;
getline(cin, input);
string changeSpace(string input)
{
for (int i = 0; i < text.length(); i++)
{
if (text[i] == ' ')
text[i] = '+';
}
return text;
}
input = changeSpace(input);
cout << input << endl;
string url = string(google + input);
system(string("start " + url).c_str());
cout << url << endl;
}
The error is here:
string changeSpace(string input)
{
In the bracket it says it expected a " ; "
And I don't know why ocurrs that error, it may be a simple mistake, but I don't know it.
Please help me.