Guest User

Untitled

a guest
Feb 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <exception>
  3.  
  4. int main (int argc, char ** argv)
  5. {
  6. try {
  7. int zero = 0;
  8. int result = 1 / zero;
  9. }
  10. catch (std::exception& e) {
  11. std::cerr << "Catch intNoZero / intZero, by std::exception; " << e.what () << std::endl;
  12. }
  13. catch (...) {
  14. std::cerr << "Catch intNoZero / intZero, by ..." << std::endl;
  15. }
  16.  
  17. std::cout << "Normal finish of program." << std::endl;
  18. return 0;
  19. }
  20.  
  21. g++ main.cpp
  22. ./a.out
  23. Floating point exception
Add Comment
Please, Sign In to add comment