Hi, I've been trying to make a very simple text game, but I can't get it to work, the program gets stuck in the while loop, simply repeating the cout"invalid command" line, and i cant for the life of me figure out why:
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string option1;
cout<<"What would you like to do?\n";
cout<<"walk to door";
cout<<"\nwalk to chest";
getline(cin, option1, '\n');
while (option1 != "walk to door" "walk to chest" ) {
cout<<"Invalid command, please reenter: \n";
getline(cin, option1, '\n');
}
if (option1 == "walk to door") {
cout<<"You walk towards the door";
}
else {
cout<<"You walk towards the chest";
}
cin.ignore();
}
I greatly appreciate any help you can offer