Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In addition to including an exceptions library, you can also create exceptions by using the throw keyword. (1pt) Create a function called int throwsInt() that

In addition to including an exceptions library, you can also create exceptions by using the throw keyword.

(1pt) Create a function called int throwsInt() that will throw an integer

(1pt) Create a function called double throwsDouble() that will throw a double

(2pt) Using try/catch statements, expand the code stubs to call each function in it's own try block, and catch and report the thrown value.

Provided code:

#include

using namespace std;

int throwsInt();

double throwsDouble();

int main() { cout << "about to run throwsInt()" << endl; try { int val = throwsInt(); cout << "val: " << val << endl; } catch (int i) { cout << "Caught integer: " << i << endl; } cout << "about to run throwsDouble()" << endl; // Build your try/catch based on the example above! }

int throwsInt() { //implement this function here }

double throwsDouble() { //implement this function here }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Visualization A Practical Introduction

Authors: Kieran Healy

1st Edition

0691181624, 978-0691181622

More Books

Students also viewed these Databases questions

Question

4. What is Title VII? What does it state?

Answered: 1 week ago