Lab C++ Right Triangles

THE PROBLEM: Design and write a program in C++ that will printout a series of right triangles built of asterisks “*”.  Each of the triangles will be printed out one asterisk at a time using for-loops.  Each of the triangles shall be 10 asterisks high and 10 across, but in different configurations.

 

Example:

 

 *             **********             *    **********

 **           *********             **    *********

 ***          ********             ***       ********

 ****         *******            ****        *******

 *****        ******             *****         ******

 ******        *****             ******         *****

 *******      ****             *******         ****

 ********     ***             ********           ***

 *********    **            *********            **

 **********   *             **********             *

 

Note: The triangles will not print out on the same line as above.

They will be printed out vertically, one after the other:

1.      *

      **

 

2.      **

      *

 

3.        *

      **

 

4.      **

        *

THE DESIGN: Recall the steps in problem-solving, go through each one in this project.  Your top-down design, written in your program comments, must be complete.  Your design will be compared to your program.

 

IMPLEMENTATION: In the entire program, you may only cout three possible things:  “ “ ,  “\n” or “*”.   You may not cout more than one character at a time. To build the triangles, use loops that count how many elements have been printed.

 

WHAT TO HAND IN: You may document your design as comments at the top of your program.  You must hand in your program and sample test run on paper.