logo CodeStepByStep logo

asciiFigure

Language/Type: C++ for nested loops

Write a function named asciiFigure that accepts an integer parameter called size and draws a figure of the following form, using for loops. The call of asciiFigure(5); would produce the following output:

////////////////\\\\\\\\\\\\\\\\
////////////********\\\\\\\\\\\\
////////****************\\\\\\\\
////************************\\\\
********************************

The size parameter can be used to create a similar figure of any size. The call of asciiFigure(3); would produce the following output:

////////\\\\\\\\
////********\\\\
****************

The call of asciiFigure(7); would produce the following output:

////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\
////////////////////********\\\\\\\\\\\\\\\\\\\\
////////////////****************\\\\\\\\\\\\\\\\
////////////************************\\\\\\\\\\\\
////////********************************\\\\\\\\
////****************************************\\\\
************************************************
Function: Write a C++ function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.