I am testing stuff, and seems like I found something that is not working as intended.
int main()
{
int number;
cout << "Please enter a number." << endl;
cin >> number;
while(!(cin >> number))
{
cout << "Please enter a number" << endl;
cin.clear();
cin.ignore(123, '\n');
}
cout << "number is " << number << endl;
return 0;
}
The input validation works, for the most part. The only issue comes when the input is something like 35'5 or even 2I, which I would not want that input to be recognized as the number 35 or 2.
Does anyone know a solution for this?