Errr, ignore that last part. Sometimes I'm unclear.
Student student;
for(int subject = 0; subject < 4; subject++){
string code;
int cu;
char pass_or_fail;
inFile >> code;
inFile >> cu;
inFile >> pass_or_fail;
//subject == loop variable
subjects[subject].setCode(code);
subjects[subject].setCU(cu);
subjects[subject].setPF(pass_or_fail);
}
I meant something like that. That's the "input" loop. Now, as you can see, this one is for subjects, but you should also create one for students for their variables. Same goes for output. If you don't know how, first write the code for reading in 1 student, then simply loop that.