Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Databases questions

Question

The company has fair promotion/advancement policies.

Answered: 1 week ago