C++ pointers, Struct, and Vectors

I have an assignment to work on that I don't understand. Would appreciate any assistance to get me headed in the right direction. The instructions for this are:

Define a structure Student with a name and a vector<Course*> of courses.
• Define a structure Course with a name and a vector<Student*> of enrolled students.
• Define a function void print_student(Student* s) that print the name of a student and the names of all courses that the student takes.
• Define a function void print_course(Course* c) the prints the name of a course and the names of all students in that course.
• Define a function void enroll(Student* s, Course* c) that enrolls the given student in the given course, updating both vectors.
Note: because the Student structure refers to Course, and Course refers to Student, you'll need to use a structure declaration (aka—a forward reference) to allow you to write the definitions in the header file.

This is what I have in my header file:

In my .cpp file this is what I have:

I'm using Visual Studio 2013 and I can't get anything to compile. I'm not even sure what to do, any help would be appreciated. Thank you.

Hi there, you will need to include the standard library headers for the artifacts that you're using in your header file. Otherwise the compiler will puke when it comes across a name that it can't find. You will also either have to (not recommended) put a 'using' declaration in your header or (recommended) explicitly qualify the artifacts that you're using from standard headers.

Typically, a C++ interface / implementation pair are used in this fashion:

The #include directive is essentially a glorified copy and paste. When #including a file, all that you are doing is telling the compiler to paste whatever is in the file in the spot that you've #included it. So in this case, you're pasting your header file at the top of your implementation file, then feeding the compiler the resulting 'translation unit' as it's called.

Another issue that I can see off-hand is in your printing functions, you're printing out the pointers that are provided.

This then of course makes memory management a bit tricky. There is a better way using *Modern C++* as illustrated below:

I'm sorry that your instructor is still teaching outdated C++. Bear with it until you pass the course, then explore the wonders of "modern" C++.