anyone i have a problem understanding this fstream my instructor gave me a problem regarding this topic
here it is!
write a program that will get the average of ten numbers.
the problem is how can i add and then divide it and then output it
the ten numbers are already given in type double
i dont know if i should use array!
plz help me understand
tnx!!!
avg
30.5
11.3
12.3
8.6
9.9
27.5
8.3
12.6
3.9
9.8
this are the numbers that i will get the average!
he say's that the output will be on the file and on the screen!
I'd rather not just give you the answer to the problem, but here's a fiveline pseudocode program of what to do:
[code]
open the file
read all of the data in the file into an array of size 10
set q = (array[0] + array[1] + array[2] + array[3] + array[4] + array[5] + array[6] + array[7] + array[9]) / 10
print q to the standard output
write q to the input file
[/quote]