#include #include #include //for class runtime_error using namespace std; void f(); //function declaration int main() { try { f(); } catch (runtime_error& r) { cerr << r.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; //Arrive here if no exception was thrown. } void f() //function definition { int dividend {0}; cout << "What is the dividend? "; cin >> dividend; int divisor {0}; cout << "What is the divisor? "; cin >> divisor; if (divisor == 0) { runtime_error re {"Attempted division by zero."}; throw re; } cout << "The quotient is " << dividend / divisor << ".\n"; }