Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A. Run the program advance20.ccp, which displays five rows of asterisks. Close the Command Prompt window. B. Modify the program to allow the user to

A. Run the program advance20.ccp, which displays five rows of asterisks. Close the Command Prompt window.

B. Modify the program to allow the user to specify the outer loops ending and increment values. The ending value determines the maximum number of asterisks to display. The increment value determines the number of asterisks to repeat.

C. Run the program you made from B. Test the program by entering the numbers 4 and 1 as the maximum number of asterisks and the number of asterisks to repeat, respectively. The program should display four rows of asterisks as follows: one asterisk, two asterisks, three asterisks, and four asterisks.

D. Run the program again. This time, enter the numbers 9 and 3 as the maximum number of asterisks and the number of asterisks to repeat, respectively. The program should display three rows of asterisks as follows: three asterisks, six asterisks, and nine asterisks.

E. Run the program again. Enter 7 and 3 as the maximum number of asterisks and the number of asterisks to repeat, respectively. The program displays only two rows of asterisks. The first row contains the expected three asterisks, but the second row contains six asterisks rather than seven asterisks. This is because the maximum number of asterisks (7) is not evenly divisible by the number of asterisks to repeat (3). Modify the program so that it displays the asterisks only when the maximum number is evenly divisible by the number to repeat; otherwise, display the message The maximum number must be evenly divisible by the number to repeat.

F. Then run the program. Test the program three times, using the data from Steps c, d, and e. Make sure to take a snap-shot of your results and upload you code and results using the uplink.

//Advanced20.cpp - displays a pattern of asterisks //Created/revised by  on  #include  using namespace std; int main() { for (int outer = 2; outer < 11; outer += 2) { for (int nested = 1; nested <= outer; nested += 1) cout << '*'; //end for cout << endl; } //end for return 0; } //end of main function

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

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago