Random Math problem generator
Hello I need help. I am trying to input the function so that should take "+,-,*, or /" as an choice in order to then input a random math problem to solve based on the symbol the user picked however whenever i input one of these symbols it will mark it as wrong or will say it isnt one of the symbols listed above, how can i make it so that the quote " cout << "SORRY, PLEASE ONLY ENTER A SYMBOL LISTED ABOVE!";" doesnt pop up when I actually input a symbol listed above? //C++ Program FINAL PROJECT //Gabriel Reyes, February 5, 2022 CIS-5 #include<iostream> #include<cmath> using namespace std; int main() { char sym_choice; //Symbol Choice int one, two; cout << "\tHello, please Select A symbol to\n"; cout << "\tsolve a random math problem between\n"; cout << "\t(+,-,*,/)\n\n"; cout << "\tENTER YOUR CHOICE: "; cin >> sym_choice; if (sym_choice != '+', '-', '*', '/') { cout << "SORRY, PLEASE ONLY ENTER A SYMBOL LISTED ABOVE!"; } int answer = 0; bool CORRECT = false; one = rand() % 500 + 1; two = rand() % 500 + 1; std::cout << "What is " << one << " " << sym_choice << " " << two << "? "; switch (sym_choice) { case '+': if (answer == one + two) CORRECT = true; break; case '-': if (answer == one - two) CORRECT = true; break; case '*': if (answer == one * two) CORRECT = true; break; case '/': if (answer == one / two) CORRECT = true; break; } if (CORRECT == true) { cout << "Nice job!" << endl; } return 0; }