I'm having some trouble with a small number generator thingy. Everything works the way it should, yet I'm just fixing errors. I'm extremely new to coding, started barely 2 weeks ago, so please excuse my lack of knowledge.
Here's my code:
cout << "\n\nPlease enter a number for one of the following:" << endl;
cout << "1: Completely random number generator (no specified limit)" << endl;
cout << "2: Number generated from x to x, you decide" << endl;
cout << "3: Number generated from 1 to 100" << endl;
cout << "4: Number generated from 1 to 10" << endl;
cout << "5: Random number generated with decimal\n\n" << endl;
int menuSelection;
cin >> menuSelection;
system("cls");
if (menuSelection != 1||2||3||4||5 ) // my problem lies here
{
cout << "Please enter a valid selection from 1 to 5!" << endl;
goto mainMenu;
}
Basically, I want my program to not screw up and crash when someone cheeky enters something that is not an integer, and to output that error.