Ask the user to enter any number except -100 (can be any number though, 100 is just a random number i picked) . If -100 is selected the program ends and displays Your number is invalid or whatever.
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main(int argc, constchar * argv[]) {
int input = 0;
bool run_menu = true;
while (run_menu) {
cout << "please enter any number " << endl;
cin >> input;
if (input != -100) {
cout << "Your number is invalid or whatever" << endl;
run_menu = false;
}
}
return 0;
}