Question: In C + + please. Triangle Printer 2 The existing code reads in a number and prints a series of rows. Modify it so it

In C++ please. Triangle Printer 2
The existing code reads in a number and prints a series of rows. Modify it so it prints the right number of stars in each row and the right number of spaces before the stars so that the final image looks like the pictures below.
InputShape1
*
2
***
3
******
4
**********
Hints:
Start by printing the right number of stars in each row. Don't worry about the spaces. Once that loop is working, then worry about printing the spaces.
You will need another loop to print the spaces... the "space" logic should be separate from the "star" logic.
You can print a space with:
cout <<"";
How does the number of spaces on each line relate to the current line number and the total number of lines?
First focus on just determining the right number of spaces to print on each line. For example, when the input is 4, the number of spaces to print in each row would be
3
2
1
0

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 Programming Questions!