Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a recursive function named printLine ( ) which receives a character and an int parameters. If the int parameter is positive, the function prints

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:
Example run:
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.
image text in transcribed

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions