Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <exception>
- int main (int argc, char ** argv)
- {
- try {
- int zero = 0;
- int result = 1 / zero;
- }
- catch (std::exception& e) {
- std::cerr << "Catch intNoZero / intZero, by std::exception; " << e.what () << std::endl;
- }
- catch (...) {
- std::cerr << "Catch intNoZero / intZero, by ..." << std::endl;
- }
- std::cout << "Normal finish of program." << std::endl;
- return 0;
- }
- g++ main.cpp
- ./a.out
- Floating point exception
Add Comment
Please, Sign In to add comment