Is it okay to use this string answer = "A || B";
? than using this if (answer == A || answer == B)?
.
I want to put two condition in the while statement
in the program but I'm having a hard time solving it since it get's an error.
// variables
string answerA = "Coin";
string guess;
int guessCount = 0;
int guessLimit = 3;
bool outOfGuesses = false;
cout << "Question A!\n" << endl;
cout << "A. What has a head and a tail, but no body?\n";
// if the answer is not correct, ask again only 3 times
while (answerA != guess && !outOfGuesses) {
if (guessCount < guessLimit) {
cout << "Answer: ";
cin >> guess;
guessCount++;
} else {
outOfGuesses = true;
}
}
if (outOfGuesses)
{
cout << "Your answers are all wrong! Better luck next time :)";
}
else
{
cout << "Your answer is Correct! ";
}