Mean, median, and mode

Create a program that prompts the user for ten integer numbers in any order between zero and nine. The numbers should be stored in an array. The program should call up four functions. Send the variable with the numbers down to the functions. Three of the functions should find the mean, median, and mode of the list. The last function should sort the numbers and print them in descending order or ascending order. Print out all the results in the function and return nothing.
Last edited on
Create a program that prompts the user for ten integer numbers in any order between zero and nine. The numbers should be stored in an array. The program should call up four functions. Send the variable with the numbers down to the functions. Three of the functions should find the mean, median, and mode of the list. The last function should sort the numbers and print them in descending order or ascending order. Print out all the results in the function and return nothing.


I am assuming this homework so here are a couple of tips on how to potentially solve this question:

a) sort the list or write the program such that when the data is inputted by the user results in a sorted list. Why? because this will be the best way to find the median. Where median is defined by http://en.wikipedia.org/wiki/Median

b) Remember that other functions can call upon other functions so in truth your fourth function can actually call upon the mean, median, and mode

c) Since mode is defined as:

http://en.wikipedia.org/wiki/Mode_%28statistics%29

you may want to consider switching the array of inputs into a histogram in order to determine which variable occurs the most often and then return the value. See, http://www.cplusplus.com/forum/beginner/124789/ on ideas on how to do that.

Best of luck.
Topic archived. No new replies allowed.