Ok, heres what I'm having a problem with, I'll post a portion of the code that is causing the problem, then see if i can explain what im trying to do.
Right now, all I want to be able to do is access the data held in the courses vector that is contained within the vector "theStudents". Now, when I compile this program, i get an error saying
itCourses was not declared in this scope
So, I'm obviously doing something wrong, but I have no idea what. The vectors are filled in another method that reads in data from a file. I can post all my code if necessary.
Code:
struct Course
{
string name;
string grade;
};
struct Student
{
string firstName;
string lastName;
string studentNumber;
vector<Course> courses;
vector<Course>::iterator itCourses;
};
vector<Student> theStudents;
vector<Student>::iterator itStudents;
double getCourseMean(string courseName)
{
itStudents = theStudents.begin();
(*itStudents).itCourses = (*itStudents).courses.begin();
cout << (*itStudents).(*itCourses).name; //Error is thrown here
}
Right now, all I want to be able to do is access the data held in the courses vector that is contained within the vector "theStudents". Now, when I compile this program, i get an error saying
itCourses was not declared in this scope
So, I'm obviously doing something wrong, but I have no idea what. The vectors are filled in another method that reads in data from a file. I can post all my code if necessary.