Does not compile.
Here are some places you should change.
missing:
#include <string>
change:
std::cout << "No grades for " << studentName.c_str() << std::endl;
A part is also missing:
grade = new Student(studentName, course);
while (!infile.eof()) {
grade->addGrade(num);
}
The studentName, course and num variables are empty and nothing is read from the file.
I would expect something like:
while (infile >> num) {
grade->addGrade(num);
}