Hi if I could get some help with this program in c++ that would be amazing! Comment if you need anymore info. Thank you

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Hi if I could get some help with this program in c++ that would be amazing! Comment if you need anymore info. Thank you

Post by answerhappygod »

Hi if I could get some help with this program in c++ that would
be amazing! Comment if you need anymore info. Thank you
Assignment 8 Part A - required [40 points] - Recursive
algorithms
Rather than using a while statement, do-while statement, or for
statement to execute a segment of code again, the programs with
recursive algorithms use a selection statement (if or switch
statement) to determine whether to repeat the code by calling the
function again or to stop the process.
Each recursive solution has at least two cases: the base case
and the general case. The base case is the one to which we have an
answer; the general case expresses the solution in terms of a call
to itself with a smaller version of the problem. Because the
general case solves a smaller and smaller version of the original
problem, eventually the program reaches the base case where an
answer is known and the recursion stops.
Listed below are a few such programming challenges requiring
function algorithms with recursive
solutions. Carefully read the program specifications
for each recursive set of algorithms and select any TWO
from the three sets provided below.
(a) Basic Recursion with Simple Types [20 points]
For the first recursive set of algorithms for this assignment
..write a program with two separate recursive void functions to
process with an integer. Demonstrate the function algorithms
in a driver program.
Embed the two recursive functions* in a program and
write a couple of drivers to test your functions. You may use the
sample program interface provided
: sample8a.cpp Download sample8a.cpp or create your
own. Submit your final source code.
Sample8a.cpp
#include <iostream>
using namespace std;
//sample test driver code for assignment 8a
void writeUp (/*in*/ int n); //a sample function prototype
void writeDown (/*in*/ int n); //a sample function prototype
int main( )
{
cout << "calling writeUp(" << 10 << ")\n";
writeUp(10);
cout << endl;
cout << "calling writeDown(" << 10 <<
")\n";
writeDown(10);
cout << endl;
return 0;
}
//recursive void functions to be defined with appropriate
documentation
void writeUp (/*in*/ int n){
cout << "writeUp recursive algorithm to be determined...."
<< endl;
}
void writeDown (/*in*/ int n){
cout << "writeDown recursive algorithm to be determined...."
<< endl;
}
/* A sample Test results program output
calling writeUp(10) 1 2 3 4 5 6 7 8 9 10
calling writeDown(10) 10 9 8 7 6 5 4 3 2 1
*/
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply