Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 coutcin 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 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 coutcin combination that were used in Program 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 coutcin combination that was used in ProgramFor 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 coutcin combinations from the following c program example:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started