Question: Modify the following C + + program so that it uses functions and does error checking with the datathat is used in the calculations. int

Modify the following C++ program so that it uses functions and does error checking with the datathat is used in the calculations. int main() should be modified so that it calls the functions that are listed under "The Functions" headingbelow. int main() will no longer have any cout/cin statements to prompt the user for information, or anycalculations. Those will all be replaced by calling statements for functions.For each calculation, replace the calculation in main() with a calling statement for the correspondingfunction that performs the calculation. Make sure that the value returned from the function is saved inthe same variable that held the result of the calculation in Program 5.The error checking for this assignment is to make sure that invalid values cannot be used in thecalculations. The power value that is used when raising a number to a power and the value used tocalculate a factorial cannot be negative. Use a calling statement for the getNonNegativeValue() functionthat is described below as the replacement for the cout/cin combination that were used in Program 5.The divisor that is used in the division operation cannot be zero. Use a calling statement for the getNonZeroValue() function as the replacement for the cout/cin combination that was used in Program5.For addition, subtraction, multiplication, the dividend used in division, and the base value that is used when raising a number to a power, there is no real error checking to perform because any integer value can be used. Use a calling statement for the getValue() function as the replacement for the cout/cin combinations from the following c++ program example:
 Modify the following C++ program so that it uses functions and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!