#include #include using namespace std; int Fun1(const vector & data, size_t index) { int x; cout << "Starting Fun 1" << endl; x = data.at(index); cout << "Ending fun1 " << endl; return x; } int main() { vectordata{1,3,5,7,9}; try { cout << "Data.at(data.size()) is " << endl; //cout << data.at(data.size()); //cout << endl; // again, make the vector class throw an exception. // cout << data.at(data.size()) << endl; cout << Fun1(data, data.size()) << endl; // note we will not get here. cout << "And that is that " << endl; cout << endl; } catch (...) { cout << "Something went wrong. In the exception handler" << endl; } cout << "Done with the program" << endl; return 0; }