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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started