How would I format this to work?
getline (cin, mystr);
if (mystr == "good", "well", "okay", "fine", "terrific", "swell", "excellent", "decent", "awesome")
{
std::cout <<"That is good!";
}
Everything works, except I need to know how to make the 2nd line work. Thanks
For example you can make the following way
1 2 3 4 5 6 7
|
const char *words[] = { "good", "well", "okay", "fine", "terrific", "swell", "excellent", "decent", "awesome" };
getline (cin, mystr);
if ( std::find( std::begin( words ), std::end( words ), mystr ) != std::end( words ) )
{
std::cout << "That is good!";
}
|
Last edited on
You need to check each condition separately:
if(mystr == "good" || mystr == "well" || /*...*/)