C++ examples for Statement:try catch
Catching All Exceptions by using catch(...) exception handler.
#include <iostream> #include <stdexcept> int main(int argc, const char *argv[]) { try {// ww w . j a v a2s .com // throw std::exception(); // throw std::invalid_argument("invalid argument");; throw std::out_of_range("out of range"); } catch (...) { std::cout << "Exception Caught" << std::endl; } return 0; }