I have a list of things of things I need my code to do but I don't know where to begin.
I need to:
-Read the first line of a file which gives the number of grades in a set.
-Transfer everything in a input file to and output file then put the average of a set of data at the end of each line.
The input file looks like:
10
Suzy 78 92 32 100 100 80 76 87 90 100
Ray Ray 90.. etc. with an indefinite amount of students so I have to have a loop and I need to know what conditions to use in the loop.
I am completely new to file stream.
Here is the code for a function that will eventually/hopefully have all of the stuff above in it. So far I just have the average in it if that is right I don't even know.
So I kind of have a shoddy C++ Professor and I need help thank you.
void calc_score(ifstream& fin, ofstream& fout)
{
double next, average, sum = 0;
int count = 0;
while(fin >> next)
{
sum = sum + next;
count++;
}
average = sum/first;
fout<< average;
}