Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please stick the instruction. #include using namespace std; void printStars(int x); //this function should print out x stars, followed by a newline character //this is

image text in transcribed

please stick the instruction.

#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 recursicn We will be creeting pretty, pretty trianglesfarrows with asterisks You are requred to create 3 functions print Triangle, tri angl ePrint, and arrowPrint vcu can optionally choose to molement helper function, printstars. print starss deigned to make your life easier It takes a single argumer, and integer lt 20111 print cut That many stars to the console, followed by a newine character For example, acall of printstars()shouid print out First, work on implementing pr. inliriangle AcallofprintiriaIr(); should prrt at Next, wrk on your IriangIrPrinl implementan I shouldhe roughly cpposite of prinliriale A call of Iiang rpriml(); should prin ou ne you have those luncicrns working, arrowprint is last. This should look sirilar so culling both functions back uo back A call of arrowprint ()should print ou Note hor there is only one Iine of 3 astensks! You can pass the ab wthoutimplementing printstars, but it will make your life more difficult. As always with recursive functions, make sure you have platted out an escape route first

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions