#include #include using namespace std; int main(int argc, char **argv) { cout << "Please input some integers, RETURN or space after each one: "; int i; while (cin >> i) { //while (cin.operator>>(i).operator void *()) { cout << "The value is " << i << ".\n"; } if (cin.eof()) { cout << "The loop terminated because it encountered end of\n" << "file.\n"; } else if (cin.bad()) { cout << "The loop terminated because it could no longer hear\n" << "from the outside world.\n"; } else if (cin.fail()) { cout << "The loop terminated because the first non-whitepace\n" << "character encountered was neither a digit nor a\n" << "minus sign followed by a digit.\n"; } else { cerr << argv[0] << ": I don't know why the loop terminated.\n"; } return cin.eof() ? EXIT_SUCCESS : EXIT_FAILURE; }