I am writing a simple math quiz which involves random numbers. After the user has finished the quiz, they are asked to retry the quiz. To try again, they must type 'yes'. However, when I do the following, no matter what I type the code starts again? Even if I write something like potato it starts again? Thanks
1 2 3 4 5 6 7 8 9
string retry;
if (retry == "Yes" or "yes" or "y"){
repeat the code
}
else{
do nothing
}
#include <iostream>
int main() {
//...
char retry;
std::cout << "If you want to restart the program, please type 'Y'."\n";
std::cin >> retry;
if (retry == "y" | "Y") {
//repeat the code..
} //if
//...
} //int main
Sorry if this is a bit confusing.
What I am trying to tell you is, that you should use the iostream to "catch" the results ;)