so when i have my if statement, if someone goes to put in say: 1 for the answer, and 1 wasnt a choice, when i put it in again it closes the program, heres an example
int action;
cout << "press 2, 3, or 4." << endl;
cin >> action;
if (action == 2)
cout << "you picked 2" << endl;
else if (action == 3)
cout << "you picked 3" << endl;
else if (action == 4)
cout << "you picked 4" << endl;
else cin >> action
how do i make it so if they were to put in 1.
then it would wait for them to put in 2 3 or 4 to output something?