int main() { int temp; while (cin>>temp, !cin.eof()) { if (cin.bad()) { throw r
If you use formatted input/output the data must match. x is not an integer. Try to enter 5 Enter. Or define temp as std::string.
x
5
Enter
temp
std::string