try { while ( !( cin >> OptionNum) ) { cin.ignore(99999); throw OptionNum; } } catch (int e) { cout << e; }