I'm having problems linking my list with this c++ program can someone help please. I have the file of what i've done so far. I need help bad
I'm having problems linking my list with this c++ program can someone help please. I have the file of what i've done so far. I need help bad
You'll need to actually post whatever code you've written so far (remember to put any code inside the [CODE] [/CODE] tags) if you want someone to help you. We can't see what your doing wrong if we can't see exactly what you did in the first place.
Code://linklist.cpp class Student { public: // Variables int StudentID; string Name; string Address; int Units; double GPA; // Constructors: Student(); // <== Same name, No Return type Student(string Name); Student(string Name, string Address, int Units, double GPA=0.00); // Other Functions: void Party(); // Destructor: ~Student(); // <== Tilde ~Same name, No Return type }; // <== Don’t forget the semi-colon!!! // First Constructor (stub): Student::Student() { cout << "I am created!\n"; } // Function (stub): void Student::Party() { cout << "Yipee!\n"; } // Destructor (stub): Student::~Student() { cout << "I am destructed!\n"; }
//client.cpp
Code:#include "Linklist.h int main () { LinkList list; list.Print(); list.RemoveFirst(); list.Print(); list.Search(67); list.Print(); return 0; }
// linklist.h (missing) i need help!!!!!!!
here's the link for the actual assignment
http://www.mediafire.com/?7yah4696cvp7cny
Last edited by deemusic836; 11-27-2010 at 11:48 AM. Reason: add on
What is the following line of code missing?
Code:#include "Linklist.h
implementing this part is frustrating me
LinkList list;
list.Print();
list.RemoveFirst();
list.Print();
list.Search(67);
list.Print();
Perhaps I am missing something really trivial, and if that is the case, feel free to point it out to me, but in the code you have posted you say:
"implementing this part is frustrating me
LinkList list;
..."
Yet in all the other code you have posted (namely 'LinkList.cpp'), you make no reference to your type 'LinkList', instead you have all these references to a class called 'Student'. How is 'Student' related to 'LinkList' (I presume 'LinkList' is a class, but I am yet to see that in code). Not to mention, you are giving no information about exactly why implementing the code listed is frustrating you - What exactly is the problem? What compilation errors do you get - if any?
The better and more precise the questions you ask, the better and more precise will be your answers. You are attempting to get answers to your questions without giving anyone on here adequate information - no wonder you haven't had any particularly useful responses in this thread so far.
Maybe you should use a struct:
This is an example of a linked list. what you wrote was not a linked list. Notice "Student * prev" and "Student * next", those are the links to the previous struct student and next struct student.Code:struct Student { int StudentID; string Name; string Address; int Units; double GPA; Student * prev; // link to the student before Student * next; // link to the student after } class CLASSROM // for example { private: Student * head; // this is the head of the list public: ... }