I am just trying to store an answer of yes or no from user, but the program doesn't switch to the correct if statement. No matter what the user inputs, control passes to the first if statement. So even if the answer is No, it still goes on to the if statement for if Yes were to have been entered.
// practice
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
string uGame;
// Stores user's name
string UserName;
cout << "Hello user. Please enter your name." <<endl;
cin >> UserName;
//Option to play or terminate
string answer;
cout << "Nice to meet you " << UserName << ". Would you like to play a game with me?" <<endl;
cout << "" <<endl;
cout << "Please type Yes or No ";
cin >> answer;
if (answer == "Yes" , "YES" , "yes")
{
cout << "Fantastic! Would you like to play a Math or Word game?";
cin >> uGame;
}
if (answer == "No" , "NO" , "no")
{
cout << "I am sorry to hear that.";
}
}