-
take in a string
I have a function that prints a bunch of junk, then leaves it up to the user to determine what they want to do next. I want them to type in the string "run hello.exe" and then whenever they type in something other than that, I want the program to say "Bad command" and keep doing that until the user types the correct string. How should I go about this?
--Thanks
-
Code:
#include <string>
#include <iostream>
using namespace std;
//...
string input;
getline(cin, input);
while (input != "run hello.exe")
{
cout << "Bad command" << endl;
getline(cin, input);
}
Something like that should work.