I am trying to code a little game-like adventure program, and I need if else statements in it for it to work correctly. However, whenever I run this if else statement, it does not output what I want.
#include <iostream>
using namespace std;
int main()
{
while(true)
{
cout << endl << "What will you do?: ";
string input;
cin >> input;
if (input == "Nothing" || input == "nothing")
{
cout << "Why would you do nothing?" << endl;
}
else if (input == "Look North" || input == "Look north" || input == "look North" || input == "look north")
{
cout << "You look north. There is nothing north." << endl;
}
}
}
What I expect it to output would be this:
What will you do?: nothing
Why would you do nothing?
What will you do?: look north
You look north. There is nothing north.
What will you do?:
But instead of getting that when I put those as an input, I get this:
What will you do?: nothing
Why would you do nothing?
What will you do?: look north
What will you do?:
What will you do?:
I would like some help on resolving this issue, as I cannot find an answer to why this would be happening.