#include using namespace std; int main() { cin.exceptions(ios::failbit|ios::badbit); try { int n; cout << "n: "; cin >> n; cout << "n: " << n << endl; } catch (const ios::failure& e) { cerr << "I/O-exception: " << e.what() << endl; } return 0; }