Is there a way in C++ to validate user data for lack of a better term?
For instance I want to write a program that asks a user for numeric input do some calculations on that data and then ask if the user wants to quit.. Since my code would be expecting numeric input what would be the best way to input a sentinal? I was thinking "Q" to quit but that would genereate an error if the program is expecting numeric right?
cout<<"This program runs in a loop enter Q to quit"<<endl;
cout<<"Enter your first number"<<endl;
cout<<"Enter 2nd number"<<endl;
since firstNum would be expecting data type of int if a user enters Q it woldn't work correct?