BEST代写-线上留学生作业代写 & 论文代写专家


C++编程代写 | List Random Numbers

C++编程代写 | List Random Numbers



Write a program that will insert random integers between 1 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 1 and 150 and put them in the list.

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

Let’s 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).


List of sorted List numbers on separate lines.

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

Document your program with at least 4 lines of comments at the top and at least 5 comments throughout the code for all of the not easily understandable lines of code.  Run your program twice using the following number of elements.  Submit your main program and submit the output text file of results.

1st run: 5 numbers

2nd run: 25 numbers