Question: (using c++) Write 2 Functions called powerIter() and powerRec(), each mothed takes 2 arguments (double n and int p). powerIter() method returns the value of

(using c++)

Write 2 Functions called powerIter() and powerRec(), each mothed takes 2 arguments (double n and int p).

powerIter() method returns the value of n to the power of p using an iteration methodology and powerRec() returns the same value using a Recursion methodology.

overload these 2 methods so that if the argument p is omitted, the number n will be sequared.

Write a main method that gets 2 values from the user (n and p) to test these 4 functions

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!