// CS2310 Exercise 19 // // Name ________________________ SSN ________________ // // Chapter 17 p1013 - 11, 12 // Write a Sum function that returns the sum of its two // nonnegative int parameters unless the sum would exceed INT_MAX, // in which case it throws an exception. // // Write a try-catch statement that calls the Sum function and, // if an exception is thrown, prints an error message and // terminates the program. #include #include using namespace std; // Write the Sum function definition here. int main() { int i, j; // Call the function with small integers i = 123; j =456; // Write the try-catch statement here, using i and j as // arguments. The program should print out the sum of i and j. // Call the function with large integers i = 123; j = INT_MAX - 10; // Write the try-catch statement here, using i and j as // arguments. The program should print out an error message. return 0; }