Apologies in advance if this is a really dumb question, but I'm pretty new at C++. Anyway, I have a Student object that has the following toString:
Various Student objects are stored in a vector (within StudentRecord.cpp) defined as this:Code:string Student::toString() const { return studentName + "\t" + studentProgramCode; }
I am currently trying to print out all of the Student objects in the vector, using their toString. However, I'm rather stuck. I so far have this:Code:vector<Student> students;
I know the students[i] part is the bit that's wrong, but I can't work out what to put there. Thanks in advance for your help.Code:void StudentRecord::print() const { int i; for(i=0; i < students.size(); i++) { cout << students[i] << endl; } }