I am trying to create a calculator program and want to make sure a character is not accepted (e.g g) and the user is asked to input another number. Here is the code i am using inside the SWITCH. How do I make it so the menu will only accept numbers and restart if a number is not entered?
Num1 and num2 are doubles and the cases are char.
case '1' :cout << "Input first number: ";
cin >> num1;