Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num1 = 0;
- cin >> num1;
- while (cin.fail()) {
- cout << "Enter a valid number for num1";
- cin.clear();
- cin.ignore(256, 'n');
- cin >> num;
- }
- int num2 = 0;
- cin >> num2;
- while (cin.fail()) {
- cout << "Enter a valid number for num2 ";
- cin.clear();
- cin.ignore(256, 'n');
- cin >> num;
- }
Add Comment
Please, Sign In to add comment