im trying to read in course information where the first number is an employeeID the second is the course department, the third is the course number and the fourth is the number of students in course. I am checking the employeeID from the courses with that of the empID i read in earlier witht he professors but im not sure how to store it because im assigning the professor that class if the first number read in matches that employees ID number. But all course info must be private data in class Course but be able to access it from class Instructor. If you can help it would be appreciated.
Code:
void readCourses(ifstream &I, Course R,Instructor *S[])
{
string courseDepartment;
int numStudents;
string courseNumber;
string employeeID;
while(!I.eof())
{
I >> employeeID >> courseDepartment >> courseNumber >> numStudents;
if(I.eof())
break;
for(int instructorIndex = LOOP_BASE; instructorIndex < MAX_INSTRUCTORS; instructorIndex++)
{
int index=0;
if(S[instructorIndex]->getEmployeeID() == employeeID)
{
S[instructorIndex]->TC[index]=employeeID;
S[instructorIndex]->TC[index]->courseDepartment=courseDepartment;
//Help inside of this statement
}
}
}
}
Code:
private:
string firstName;
string lastName;
string middleInitial;
string employeeID;
Course *TC[4];
}; // end class Instuctor
Code:
lass Course {
public:
Course(); //constructor
~Course();
private:
string courseDepartment;
string courseName;
string numStudents;
};