Hi everyone,

I am trying to write a program involving adding nodes to a single linked list and allowing the user to enter the names of students and the student numbers up to as many as they wish. I want to add the nodes that the user enters to the list so that the entire list of data is sorted by student number in ascending order including the student data which is NOT entered by the user (which are the five initialized students in main() before we get any data from the user). It is set up so that the list is displayed before and after EVERY time a student is added to the list by the user. I have sorted stuff many times with arrays before but this is my first time doing it with linked lists so I was wondering how I can go about doing this in my code which is listed below:

Code:
#include <iostream>
#include <string>
#include <stdlib.h>

struct link {
    int stnum;
    string name;
    link *next;
};

class linklist {

   private:
      link *first;

   public:
      linklist() {
         first = NULL;
      }
    void additem(int s, string n);
    void display();
};

void linklist::additem(int s,string n) {
    link * newlink = new link;
    newlink -> stnum = s;
    newlink -> name = n;
    newlink -> next = first;
    first = newlink;
}

void linklist::display() {
    link *current = first;
    while(current != NULL) {
        cout << current->stnum << "   " << current->name <<endl;
        current = current -> next;
    }
}

int main() {
    int numstud, i;
    int stunum;
    string sname;
    linklist student;
    student.additem(1315,"Mary");
    student.additem(1307,"John");
    student.additem(1293,"Kim");
    student.additem(1270,"Marty");
    student.additem(1258,"Linda");
    cout << "Enter # of students you wish to add to the list: ";
    cin >> numstud;
    cout << endl;
    for (i = 0; i < numstud; i++) {
       cout << "Enter the student number: ";
       cin >> stunum;
       cout << endl;
       cout << "Enter the student name: ";
       cin >> sname;
       student.additem(stunum, sname);
       student.display();
    }
    cin.get();
    return 0;
}
Any assistance would be greatly appreciated. Thanks.