Question: C++ List Random Numbers(no Maps) Write a program that will insert random integers between 0 and 150 into a list and perform some calculations. You

C++ List Random Numbers(no Maps)

Write a program that will insert random integers between 0 and 150 into a list and perform some calculations. You will prompt the user to ask them the number of elements in your list. You will then get that many random numbers between 0 and 150 and put them in the list.

You will sort the numbers in your list. Now, use an iterator to the screen to print the elements in your list.

Lets work with the list to perform some calculations. Use iterators, algorithms, and list functions (not the user's input variable) to find the sum (iterate through to sum up the elements), mean (average is sum divided by size of list), median (middle value - find the size and use the iterator to move up half way by iterating the iterator half the size times), and range (use algorithms to find the highest and lowest and then take the difference between highest and lowest). Then print the labeled values (with the mean to three decimal places).

Output:

List of sorted List numbers on separate lines.

The sum, average to three decimal places, median, and range of the numbers in your list.

Please Document your program with at least 4 lines of comments at the top and at least 5 comments throughout the code so, reader will understand better. Run your program twice using the following number of elements.

1st run: 5 numbers

2nd run: 25 numbers

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!