Question
For this assignment, you will design and implement two different functions that compute and return the value of a number of type double raised to
For this assignment, you will design and implement two different functions that compute and return the value of a number of type double raised to a power of type unsigned int. (unsigned int variables can take only non-negative integer values.) Your program should test both functions.
The first function must be named poweriter and take the double parameter first and the unsigned int parameter second. This function should use an iterative approach with a loop to compute the power.
The second function must be named powerrecur and take the double parameter first and the unsigned int parameter second. This function should compute the power using recursion.
Write a main function that tests both power functions. Show that both functions compute b0 and b1 correctly for two different non-zero values of b. Test each function for at least four additional cases of base and power. Make sure to test using a value of power > 10.
Submit two files for the assignment: one file with your program including the definitions of the functions and the main program, and an additional file that shows the output of a run of your test
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