fork(2) download
  1. #include <iostream>
  2. int main()
  3. {
  4. std::cin.exceptions(std::ios::failbit);
  5. try {
  6. int userNumber;
  7. std::cin >> userNumber;
  8. } catch(const std::ios_base::failure& e) {
  9. std::cout << "Error message\n";
  10. }
  11. }
  12.  
Success #stdin #stdout 0.01s 2724KB
stdin
42
stdout
Standard output is empty