Hello!
I'm trying to create a linked list where each node contains a grade level (ints), and where each node points to a linked list of students and information about them (age, Last name, first name). It will look like this
Grade 1 -------> Grade 2 -------> Grade 3 -------> Grade 4 -------> NULL
'''''|''''''''''''''''''''''''''''''''|''''''''''''''''''''''''''''''''|'''''''''''''''''''''''''''''''|
''''\/'''''''''''''''''''''''''''''''\/''''''''''''''''''''''''''''''\/'''''''''''''''''''''''''''''\/
Student 1'''''''''''Student 1''''''''''Student 1''''''''''''Student 1
'''''|''''''''''''''''''''''''''''''''|''''''''''''''''''''''''''''''''|'''''''''''''''''''''''''''''''|
''''\/'''''''''''''''''''''''''''''''\/''''''''''''''''''''''''''''''\/'''''''''''''''''''''''''''''\/
Student 2'''''''''''Student 2''''''''''Student 2''''''''''''Student 2
etc...
So far I have the first linked list finished (the grade level one). It can add, delete, and print the contents of the nodes. I'm not entirely sure how I make each of the nodes have their own linked list that has the same functionality (I want to be able to add, delete and print the students of each grade level)
Here is my header file, please let me know what I need to add in order to make this work!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#include <stdio.h>
class List
{
private:
typedef struct node{
int data;
node* next;
}*nodePtr;
nodePtr head;
nodePtr curr;
nodePtr temp;
public:
List();
void AddNode(int addData);
void DeleteNode(int delData);
void PrintList();
};
|
I've spent a good deal of time on trying to figure this out. I know the above doesn't show this, but I've started over multiple times. I'm trying to start this over on a clean slate, and hopefully get help from people much better at this than me, so I don't run into a dead end again.
Any help would be greatly appreciated!