// Fortune Teller
#include <iostream>
#include <cstring>
#include <string>
usingnamespace std;
int main()
{
//first choice
string choice1;
cout << "Do you like chicken nuggets: ";
cin >> choice1;
if (choice1 == "Yes" || choice1 == "yes")
{}
else
{
while (choice1 != "Yes" || choice1 != "yes" || choice1 != "No" || choice1 != "no");
{
cout << "Sorry, your answer did not seem to qualify. You must answer Yes or No. Please try again" << endl;
cout << "Do you like chicken nuggets: ";
cin >> choice1;
}
}
return 0;
}
Everything works except the loop. When i type (for example) "lakjhf", the loop does not activate. When i take out the loop, the program works perfectly except the fact that there is no loop.
You have a semicolon at the end of line 18 that doesn't belong there.
And the while condition will always be true, as choice1 can't be equal to all of those at the same time.
Look at your condition carefully. It will be true of choice1 isn't "Yes" OR if it isn't "yes". Since it can't be both, it follows that it will have to be NOT one of those, making at least one of them true and thus the whole statement true.
Dapasta! You know that "-----" is use to print any thing on screen and '------' to equalize any value to any variable.You write YES and NO in "" ,instead of it you should write them between ' ' . You should write that in this way
Line where you give condition with if:
if (choice1 == 'Yes' || choice1 == 'yes')
Line wher you give condition of while loop:
while (choice1 != 'Yes' || choice1 != 'yes' || choice1 != 'No' || choice1 != 'no');