Question: please follow the instruction. code to follow is below. #include using namespace std; void printStars(int x); //this function should print out x stars, followed by

 please follow the instruction. code to follow is below. #include using

please follow the instruction.

code to follow is below.

#include

using namespace std;

void printStars(int x); //this function should print out x stars, followed by a newline character //this is a helper function for the following recursive functions

void printTriangle(int y); //this function should recursively print out stars, to build a triangle that is y deep. //For y = 3, this should look like this: //* //** //***

void trianglePrint(int z); //this function should recursively print out stars, to build a triangle that is z deep. //it is the opposite of printTriangle //for z = 3, it should look like this: //*** //** //*

void arrowPrint(int a); //this function should recursively print out stars, to build an arrow (kind of) that is 2a deep. //for a = 3 it should look like this: //* //** //*** //** //*

int main() { int y, z, a; cout > y; printTriangle(y); cout > z; trianglePrint(z); cout > a; arrowPrint(a);

return 0; }

void printStars(int x){ //TODO: implement this! }

void printTriangle(int y){ //TODO: implement this! }

void trianglePrint(int z){ //TODO: implement this! }

void arrowPrint(int a) { //TODO: implement this! }

10.10 LAB: Recursion This lab assignment is designed to practice working with recursion. We will be creating pretty, pretty triangles/arrows with asterisks! You are required to create 3 functions: printTriangle, trianglePrint, and arrowPrint You can optionally choose to implement a helper function, "printstars printstars is designed to make your life easier. It takes a single argument, and integer. It will print out that many stars to the console, followed by a newline character. For example, a call of printstars (3); should print out First, work on implementing printTriangle. A call of printTriangle(3); should print out Next, work on your triangle rnt implementation. It should be roughly opposite of printtriangle. A call of triangle ? should print out nt 3 Once you have those functions working, arrowPrint is last. This should look similar to calling both functions back to back. A call of arrowPrint (3); should print out Note how there is only one line of 3 asterisks! You can pass the lab without implementing printstars, but it will make your life more difficult. As always with recursive functions, make sure you have plotted out an escape route first

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!