Not working?

I keep having this issue that if someone puts in an answer other than what is given, it will show a blank screen and they will have to restart the game... any ideas how to fix this? Here is the code that I put:

1
2
3
4
5
if(Answer!="Home"; Answer!="Shop"; Answer!="Fight"){
cout << "Sorry, this is not a valid function, please try again";
Sleep(1000);
Answer=Home;]
}
Based on this and your other thread, I'd recommend going back to your textbook and re-read how to construct if statements with multiple conditions. You certainly don't use a ; symbol for logical and!
learn c++, you have to use the logical "and" && to put multiple if parameters.
If you use logical "and", won't the condition always be false since Answer cannot be both one thing and another?

Nevermind, I figured it out.
Last edited on
Replace the ";"s with "||" inside the parentheses of your if statement.
Topic archived. No new replies allowed.