I am trying to create a text game that lets the user type something, then depending on what they typed it would respond with a different thing. Something like this:
cin>> x;
switch (x)
{
case 'die' : cout<<"That was stupid, You lose\n";
break;
case 'fight' : cout<<"You chose to stay and fight\n";
//... several more options
default : cout<<"That is not a valid command, Try again\n";
}
But I can not get this to work. If i add char x; then I can get it to work, but each case can only be one letter long. Is there a way to get it so one could type in a command as a full word at cin>>x; and have it select the right case statement?