#include #include using namespace std; int main(int argc, char **argv) { cout << "Please type an integer: "; int i; //uninitialized variable cin >> i; //cin.operator>>(i); if (!cin) { //if (cin.operator!()) { if (cin.eof()) { cerr << argv[0] << ": end of input\n"; } else if (cin.bad()) { cerr << argv[0] << ": can't input characters " "from the outside world\n"; } else if (cin.fail()) { cerr << argv[0] << ": first non-whitepace character " << "encountered was neither a digit,\n" << "nor a minus sign followed by a digit.\n"; } else { cerr << argv[0] << ": unknown input error\n"; } return EXIT_FAILURE; } cout << "The integer was " << i << ".\n"; return EXIT_SUCCESS; }