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:
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;
average = sum/first;
fout<< average; 

-Since u dont know the number of grades, u can declare an array of doubles to take them all.e.g double grades[10000](If d num of students in dat class is more than 10000 then just increase the index).
-Use an ifstream to enter the grades into a stream like this:

int i=0;
double grades[10000];
ifstream fin("filename.txt");

If u dont understand the above code,just dont bother and follow SgtMe's link or get a book on file streams.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.