I have a nasty issue with 'cin' in loops. The first time through it works fine (I want to accept only an int for a function call in my program, and ignore chars that would mess it up) but subsequent 'cin' calls are ignored and the program loops indefinitely. Here's a short program to demonstrate:
I've put in an extra system("PAUSE") call to stop it looping forever.
using namespace std;
int input = 0;
cout<<"Write something then press enter: \n";
cin>> input; //<- Doesn't get called after the first time
if(input == 5)
Any suggestions on how to fix it?