Question: C + + : Write a recursive function named printLine ( ) which receives a character and an int parameters. If the int parameter is

C++:
Write a recursive function named printLine() which receives a character and an int parameters. If the int parameter is positive, the function prints the character repeatedly to form a line of the given number of character; otherwise the function does nothing. The function does not return a value. Thus, if the printLine(*,8) is called, ********(8 asterisks) will be printed. The function MUST NOT use a loop of any kind or an array to accomplish its job. Instead, it gets the job done by (recursively) calling itself. You can test printLine() first using the following example:
Then write a recursive function printBlock() that uses printLine() to print m lines of n characters each. For example, printBlock(*56) produces the character, *, in 5 lines, each has 6 of the character.

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!