Stuck in loop when value over int is entered

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.
Here is a little video of the code and running it.
http://youtu.be/VErrKrr8a88
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
Topic archived. No new replies allowed.