The program has to know what a Student is -- you need to declare it first (not necessarily define, just declare, like
otherwise you'll get in a big circle)Code:struct Student;
The program has to know what a Student is -- you need to declare it first (not necessarily define, just declare, like
otherwise you'll get in a big circle)Code:struct Student;
inside the main or outside the main??
i already have a student structure.. with the attributes.
then how?
i have a student struct already.. i can add new students, new course, and new sections..
but can't link them
maybe addCourseSection(courseSection cs) // something like this??
You have a circular sort of thing -- Student needs to know that there is such a thing as a CourseSection, and CourseSection needs to know there is such a thing as a Student. So you tell them:
Code:struct Student; //puts the name out there struct CourseSection { //all the stuff goes here }; struct Student { //now we define the thing };
declare the student struct twice?
it compiles without error..
how can i link the student struct to the course??
sorry for disturbing.. but i'm just so amateur at this
courseSection *section
inside the student struct?
Why are we starting over, here? You have four pointers to CourseSection things inside your student struct. Set one of them equal to the course you want to add.
in the add course section function or in add student function??
i'm stuck here..Code:void addStudent () { Student *temp; temp = new Student; CourseSection *cs; cs = new CourseSection; cout<<"Enter Course Section:"<<flush; }