Hello I was wondering how can I set a char limitation in my code when I am asking for an int? When you input a char my program goes crazy. Let's put the following simple program as an example:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int userChoice;
do
{
cout << "Please enter a number from 1 to 10: ";
cin >> userChoice;
}
while( userChoice < 1 || userChoice > 10);
cout << "Thank you." << endl;
system("pause");
return 0;
}
I will appreciate it.