Question: How do I edit my code in C++ to make it so that based on the user_input it will increment the number rows. It will

How do I edit my code in C++ to make it so that based on the user_input it will increment the number rows. It will also increment the number of semicolons within each row. For example, if we had an input of 1, then we would get an output of

nothing

If we had an input of 2, then we would get an output of

{:::}

If we had an input of 3, then we would get an output of

{:::}

{:::::}

If we had an input of 4, then we would get an output of

{:::}

{:::::}

{:::::::}

{:::::::::}

My Code:

int colon = 1;

for (int i = 0; i < colon - 1; i++)

{

cout << "{";

for (int j = 0; j < colon; j++) // Figure out how many colons for each level.

{

cout << ":";

}

cout << "}" << endl;

colon += 2;

}

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!