Question: Develop a c++ program 1. Make one recursive function shownumbtos( ). The function takes one integer n as parameter. The function will not return any
Develop a c++ program
1. Make one recursive function shownumbtos( ). The function takes one integer n as parameter. The function will not return any value, but it will display n(n-1)(n-2)..321. The precondition is that n is a positive integer when this function is called. For example, in the main function, if there is a call shownumbtos(6), the following will be displayed:
654321
2. Make a recursive function shownumstob( ). The function is similar to the shownumbtos( ) in question #1, but this function will display the numbers from 1 to n. For example, shownumstob(6); will display
123456
3. Make one recursive function double p(b, e). It will return (not display) the value of b raised to the power of e. For example, cout << p(2,3); will display 8, which is 2*2*2. The precondition is that b and e are both positive integers.
4. Make one recursive function f( ). The function takes one integer n as parameter. It will return the value of n*(n-1)*(n-2)...3*2*1. The precondition is that n is a positive integer.
5. In your main function,
5a. ask the user to enter a number and call shownumbtos( ) to show the result.
5b. use the same user input to call shownumstob( ) to show the result.
5c. use the same user input to display the result by calling f( ) function.
5d. ask the user to enter a base number and an exponent. Display the result of the power by calling the p( ) function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
