hi, trying to make a small block of code for trapping input errors, I wrote this:
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <iostream.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int pirla;
do
{
cout << "Inserisci un valore intero: ";
cin >> pirla;
}
while (cin.good() == false);
cout << "Il valore di pirla e' " << pirla << endl;
return EXIT_SUCCESS;
}
but if the input is wrong the do...while loop never ends keeping outputting the prompt.
why this happens? how can I put that to work?
thanks and... mercy for the newbie!