Program question--need help!!!

This is a discussion on Program question--need help!!! within the C Programming forums, part of the General Programming Boards category; Hi, I am TRYING to make a program but am having absolutely NO SUCCESS. I have read the sticky about ...

Program question--need help!!!

Hi, I am TRYING to make a program but am having absolutely NO SUCCESS. I have read the sticky about no posting homework up but I have exhausted all my resources and have tried a few things but nothing has worked. If any one could post some help or send me an e-mail with help, I would greatly appreciate it!

The problem states:

Write a program that:
Reads an arbitrary but fixed number n (set value of n to 30) of input records from the text file survey.dat each containing survey results consisting of a unique integer identifier for a customer followed by a single integer rating in the range 1-10 inclusive representing that customer's rating for a newly-marketed product. After all values have been read and stored, sort the table of values by customer ID and print to the text file results.dat the following information:

(a) the table contents sorted by customer ID suitably labeled
(b) the arithmetic mean of the ratings, suitably labeled
(c) the harmonic mean of the ratings, suitably labeled
(d) the median value of the ratings, suitably labeled (the array of survey information will need to be resorted prior to determining the median value, this time using the rating as the sort key)
(e) the mode of the ratings, suitably labeled, followed by a list of customer IDs whose ratings were equal to that mode value

I'm so confused and sorry if this creates an inconvenience to anyone, but I have tried everything and don't know what to do!!! PLEASE HELP!!!

There is another post called the FAQ that expressly states use code tags when posting code. It's pretty simple.

Code:

This is in a code block
See how the formatting is preserved
Try one out for yourself
if (!(code_tags))
{
IgnorePost();
FlamePoster();
NotifyModerator();
GiveRedBlocksToPosterReputation();
} else BeFriendlyAndHelpful();

And now a lesson in how to program:
1) Break the task up into smaller tasks.
2) Break each smaller task into even smaller tasks.
3) Goto 2.
4) When everything is broken down into the smallest steps possible, turn it into code.

Usually you do your design phase (all of the above) on paper or in an editor or some such, giving you an outline of what exactly you need to do. This commonly is called pseudocode. Something like the following:

Your task is to get numbers between 1 and 1000 from the user until they wish to stop. Find which of these numbers is the smalles, the largest, and the most frequently occuring.

So here's some pseudocode:

Code:

while not done
get number from user
process number

Code:

while not done
prompt for input
read input into variable
check variable against smallest
check variable against largest
do something to keep track of the actual number inputted

And so on...

Then, if you decide you have need of different functions to do the job, you test the functions one at a time. This makes it much easier to get everything working. In the above example, we'd first prompt for a number and read it. When we know that works right, we'd prompt for a number and read it until they entered whatever it was that signaled "quit". Then we'd stop asking and end the program. After that perhaps take the number we've read, and get "smallest" working. Once we know that works, then we'd go for "largest". And so on...

Now in the above, you have a whole bunch of functions. I personally am not going to sit around debugging all of them for you. Perhaps you could apply some of what I've illustrated above and use this method to figure out what's wrong with your program.