I am writing a C++ program that lets me search Wikipedia, Google, Wolfram Alpha, etc. I’m doing this by asking for the input (what I want to search with such as “Pictures of Cats”) and I pass that input to batch where it runs a command to open a google search using my input. Here’s what it looks like:
string input;
cout<<"What do you want to search?"<<endl;
getline(cin, input, '\n');
system(("START https://www.google.com/search?q="+input).c_str());
The problem is, if I ask it to search for “Funny cats”, it only searches for Funny. What should I do? I’m also open to suggestions of other ways to do this, other than using cmd.
Url-encode the search string: https://en.wikipedia.org/wiki/Percent-encoding