Having trouble with function to write output to file

I'm working on an assignment that deals with inheritance and a heterogeneous list. The program is supposed to read in the contents of a file, which consists of student names, grades, and what type of class they're in (math, english, history), and then calculate final grades and output a summary to a file. I have a base class called Student, 3 derived classes, Math, English and History, and then a main program that does all the file reading and output. What I'm trying to do is create a virtual function and then call that function in the main program to do the output, once I read in all the data from the file.

I'm just not getting any output to the file. Does it need to return something? Currently I have it as a void function, taking in a char array, which is the name of the output file.

My code is too long to post the entire thing, but I'll gladly post snippets as needed. Any help would be great!
deeburt wrote:
I have a base class called Student, 3 derived classes, Math, English and History,
This means that Math is-a Student, English is-a Student, and History is-a Student. Does this make sense?
The derived classes could be thought of mathStudent, englishStudent... That's just what I named them. This is an example input file I was given:

6
Bunny, Bugs
Math 90 86 80 95 100 99 96 93
Schmuckatelli, Joe
History 88 75 90
Dipwart, Marvin
English 95 76 72 88
Crack Corn, Jimmy
Math 44 58 23 76 50 59 77 68
Kirk, James T.
English 40 100 68 88
Lewinsky, Monica
History 60 72 78

This first line is the number of students in the file. Thereafter, the format is:
Last Name, First Name
Class type grade1 grade 2 ... etc.

The final averages are calculated differently depending on which class the student is in, since they obviously have different grades.
Topic archived. No new replies allowed.