James D.

asked • 09/24/21

Help with do while loop

generate a random number between 5 and 250. This will be the number of values in the third set. Display a label such as "3rd set of random numbers" and the number of values in the set.

Using a do while loop that executes exactly "number of values in the third set" number of times:

  1. generate a random number between 1 and 100
  2. display the random number

When displaying the random numbers, make sure that there are exactly 8 values displayed per line. The exception is the last line, which may have less than 8 values displayed.


this is all I have and I'm stuck.


i = 0;
const double MAXIUMUM3 = 250;

cout << "Third set of numbers" << endl;
RandNum = rand() % 250 + 5;
cout << "There are " << RandNum << " numbers in the set" << endl << endl;
do {
RandNum = rand() % 100 + 1;
cout << RandNum << ' ';
++i;
} while (i < MAXIMUM3);



1 Expert Answer

By:

Christopher C. answered • 09/30/21

Tutor
5 (8)

Software Engineer for AP Computer Science

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.