Chapter 16: Problem 9
Consider the following C++ code: int lowerLimit; int divisor; int result; try { cout << "Entering the try block." << endl; if (divisor == 0) throw 0; if (lowerLimit < 100) throw string("Lower limit violation."); result = lowerLimit / divisor; cout << "Exiting the try block." << endl; } catch (int x) { cout << "Exception: " << x << endl; result = 120; } catch (string str) { cout << "Exception: " << str << endl; } cout << "After the catch block" << endl; What is the output if: a. The value of lowerLimit is 50, and the value of divisor is 10? b. The value of lowerLimit is 50, and the value of divisor is 0? c. The value of lowerLimit is 150, and the value of divisor is 10? d. The value of lowerLimit is 150, and the value of divisor is 0?
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.