#include #include #include using namespace std; void PrintNums(vector & data) { cout << data.at(-4) << endl; } int main() { vector nums(4); try { PrintNums(nums); } catch (const logic_error & e) { cout << "Caught as logic_error " << e.what() << endl; } catch (const out_of_range & e) { cout << "Caught as out_of_range " << e.what() << endl; } catch (const bad_typeid & e) { cout << "Caught as bad_typeid " << e.what() << endl; } catch (const exception & e) { cout << "Caught as exception " << e.what() << endl; } catch (...) { cout << "Caught an exception " << endl; } return 0; }