Skip to content

Instantly share code, notes, and snippets.

@peschkaj
Created July 9, 2016 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peschkaj/14cca4165e106494ceedd5d4e8bad861 to your computer and use it in GitHub Desktop.
Save peschkaj/14cca4165e106494ceedd5d4e8bad861 to your computer and use it in GitHub Desktop.
void get_user_action(char input[MAX_INPUT_LENGTH])
{
bool validInput = false;
do
{
cout << HAND_MSG << endl;
cin.get(input, MAX_INPUT_LENGTH, '\n');
cin.ignore(100, '\n');
s_to_lower(input);
if (strcmp(QUIT, input) == 0
|| strcmp(STAND, input) == 0
|| strcmp(HIT, input) == 0)
{
validInput = true;
}
else
{
cout << "'" << input << "' was not recognized." << endl;
cin.clear();
}
} while (!validInput);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment