Question: Language required: C++ For this assignment, you will design and implement two different functions that compute and return the value of a number of type
Language required: C++
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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
