![]() |
|
#1
|
|||
|
|||
Mean (average), median, and modeWrite a program to compute the aritmetic mean (average), median, and mode for up to 50 test scores. The data are contained in a text file. The program will also print a histogram of the scores.
The program should start with a function to read the data file and fill the array. Note that there may be fewer than 50 scores. This will require that the read function return the index for the last element in the array. To determine the average. To determine the median, you mst first sort the array. The median is the score at last / 2 if last is an even inde and by averaging the scores at the floor and ceiling of last / 2 if last is odd. The mode is the score that occurs the most often. It can be determined as a byprodcut of building which score occurred most often. (Note that two scores can occur the same number of times.) This is what I came up using Bloodshed Dev-C++: CPP / C++ / C Code:
Last edited by LuciWiz : 16-Jun-2009 at 02:52.
Reason: Please insert your C++ code between [cpp] & [/cpp] tags
|
|||
|
#2
|
|||
|
|||
Re: Need Help Asap With C Programming Project!!Quote:
So what happened when you compiled it? The title that you gave the thread is, "Need Help Asap With C Programming Project!!" What kind of help would you like? The likelihood of getting help "Asap" might be improved if you ask specific questions rather than just posting the statement of the assignment along with some code that won't compile. As far as the assignment itself, my approach would be to develop the code a step at a time. Step number 1: Quote:
Regards, Dave |
|
#4
|
||||
|
||||
Re: Mean (average), median, and modeQuote:
You didn't read the part that said that there may be fewer than 50 scores. Your functions will need to know the length of the array. As Dave mentioned, you need to read the values in from a file of scores. Maybe this will help get you started: CPP / C++ / C Code:
Output: Code:
scores.txt: Code:
Remember to "mix up" the scores so that you do not always have an even number at the end for your median tests (or a zero at the beginning, too)! Note that I didn't do the mode and histogram parts. MxB |
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Tutorial] GUI programming with FLTK | dsmith | FLTK Forum | 10 | 03-Oct-2005 16:41 |
| c programming : project idea ??? | batrsau | C++ Forum | 2 | 09-Jun-2005 05:55 |
| Community Project Proposal | dsmith | Miscellaneous Programming Forum | 71 | 19-Feb-2005 13:26 |
| Need help on a project for C programming | andrew410 | C Programming Language | 1 | 30-Oct-2004 08:01 |
| Need help on simple Programming Project | daNichex6 | C Programming Language | 1 | 03-Sep-2004 19:08 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The