CS 202 Fall 2013 > In-Class Challenge for Tuesday, October 29, 2013 |
CS 202 Fall 2013
In-Class Challenge for Tuesday, October 29, 2013
Program trydiv.cpp
I have written part of a program,
in file
trydiv.cpp
.
This program includes a function divide
,
which takes two parameters of type double
.
If the quotient can be computed,
then the function returns it.
Otherwise, it throws an exception of type
domain_error
.
What to Do
Modify function main
in file
trydiv.cpp
,
so that it does the following.
- Attempt to divide using function
divide
. - If this is successful, then print the answer.
- If an exception is thrown, then print the error message.
Do not change function divide
.
CS 202 Fall 2013: In-Class Challenge for Tuesday, October 29, 2013 /
Updated: 29 Oct 2013 /
Glenn G. Chappell