QUOTE(okky @ 5 Jun, 2007 - 02:00 PM)

Write a program that writes a row of whole numbers (closed by a 0) to a textfile.
Next, write a program that determines the maximum and minimum values of those numbers in the file.
Then this program must write all numbers in this file, smaller than the average of the maximum and
the minimum, to a new textfile. After all numbers are written, the content of the new file must be
printed to the screen.
Somebody wants to help me??

I'll go along w/ the rules and say you need to provide some effort but I am bored and will help you with a vague sample solution outline.
Program 1
-at this point i am guessing you have to enter the #s in yourself
1. Prompt the user for the #s (0-terminated)
2. Store these numbers in an array of ints
3. Create an fstream object to output to the txt file
4. Attempt to create (open) the file
5. Loop through your array to output the #s to the file
6. Close the file
Program 2
1. Create an fstream object to read the #s into an array from the file stopping on 0 (or until end of file if you only have 1 line)
2. Use a sorting function on the array to get the numbers in order
* you can then determinate max/min
3. Add the numbers in the array and do your arithmetic to get the avg and what not
-I am guessing what you are sayign is that you want the program to read in the numbers from the file and then get the average of all the numbers. Then write back out to a file all of the numbers that are smaller than that average.
4. You have an array that is in order so just loop through it comparing to if each individual element is less than the average and write that number out to the file
5. Close the file when done
Hope it helps some
This post has been edited by Topher84: 6 Jun, 2007 - 06:21 AM