+ 1
ofstream in c++
I’ve made a program to calculate averages using a while and for loop and then I wanted to take each of those averages and insert them into a .txt file. Every time I do this it only ends up posting the last average. Can someone help?
4 odpowiedzi
+ 4
I see that you have an infile, which means that the values you want to calculate your average based on is stored in an external file. You may need to provide an example of the input file. The structure of the file is important for us to determine how to read it properly.
If that's not possible, I assume your file stores values in the format:
56
78
23
...
vertically?
+ 2
https://code.sololearn.com/cUmcHagKB826/#cpp
this codes counts average of all values in a single input file.
I didn't get how do you want to cont averages(from different files, single one etc.), so did this one.
0
i left some stuff out but you get the idea