Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

12.5 Program: Divide by Zero (C++) This program will test exception handling during division. The user will enter 2 numbers and attempt to divide (in

12.5 Program: Divide by Zero (C++)

This program will test exception handling during division.

The user will enter 2 numbers and attempt to divide (in a try block) the 1st number by the 2nd number.

The program will provide for 2 different catch statements:

Division by zero - denominator is zero

Division results in a negative number

The user should be prompted with Enter 2 numbers:

For input of 7 and 0 the output should be Exception: Division by zero

For input of 7 and 2 the output should be a/b = 3.5

For input of 7 and -2 the output should be Exception: Division is negative

L

Lab Submission

12.5.1: Program: Divide by Zero

Instructions

Deliverables

DivideByZero.cpp

We will expect the above file(s) to be submitted

Compile command

g++ DivideByZero.cpp -Wall -o a.out

We will use this command to compile your code

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

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

More Books

Students also viewed these Databases questions