When any value over int is entered (including letters and decimal numbers) the program gets stuck in a loop. How can I fix this?
Thanks
Last edited on
Please post the code. It's hard to say without seeing it.
Fixed it with this code thanks to someones post on yahoo answers, I also includes #include <limits>
1 2 3 4 5
|
if (cin.fail())
{
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
|
well decimal numbers still mess it up but I think it's okay.
Last edited on