Hi all. I am finishing up a project previously posted. I am to create a student 'database' that consist of one student and X number of classes the student has taken. My problem now is that i cannot run a test on the linked list correctly. I am to check to see if a student has taken a certain class, to do this, i do the following in my 'main' program:
Student s1;
....//previous code tests etc
....//insert class, remove class, etc
CourseInfo c3, c4;
string id3;
cout << "Enter the course id to be checked: ";
cin >> id3;
c3.setCourseID(id3);
c4 = s1.checkCourseTaken(s1.getZID(), c3);
cout << endl << "Test 6, check if course was taken:" << endl;
if(c4.getCourseID() == "")
cout << endl << "*** COURSE NOT TAKEN ***" << endl << endl;
else
cout << endl << "Student took " << c4.getCourseID() << " in the "
<< c4.getSemesterTaken() << " of " << c4.getYearTaken()
<< " and earned a grade of " << c4.getGrade() << "." << endl
<< endl;
Now ... i would post the functions i use, but you would probably need the other parts of code aswell so you can cross reference data members/methods etc. Sooo, i will post ALL my code files along with my 'data' file. Please review the following:
Student:
checkCourseTaken()
SinglyLinkedList:
checkCourseTaken() // calls recursive function
isInList() // has to be recursive
These are the functions used. My idea is that i have to change them a little. First off, i think the Student function needs to return a CourseInfo object (this been the case, i would need a copy constructor for my student class? So that it copies data from one object to another fully?! Also, i would like it if you could review the other 2 functions in SinglyLinkedList for correctness... i am sure they may not make sense, or even correctly function... but i will leave that up for your expert eyes to tell me.
Thanks all in advance,