Thread: Linked List

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    oak park (il)
    Posts
    1
    Rep Power
    0

    Exclamation Linked List


    AS A HOMEWORK I HAVE TO MAKE A PROGRAM USING LINKED LIST BUT I DON'T KNOW HOW TO INSERT A NEW NODE WITH THE REQUIERED INFORMATION --PLEASE HELP ME!!
    HERE'S PART OF MY CODE
    #include <iostream.h>
    #include <fstream.h>

    class Student{

    public:
    char ssn[13];
    char lname[15];
    char fname[15];
    float midt;
    float final;
    float average(){
    return ave();
    }

    Student *next;


    private:
    float ave(){
    return avg=(midt + final)/2;
    }
    };



    void main(void){

    int code;
    load data(code);


    while(!cin.eof()){
    switch(code){
    case 1:
    add_student();
    break;
    case 2;
    change_student();
    break;
    case 3;
    delete_student();
    break;
    case 4:
    print_student();
    break;
    default:
    cout<<"Please enter a digit between 1 and 4/n";
    load data(code);
    } //end switch

    load data(code)

    }//end while

    }//End main


    int load data(int code){
    cout<<"1 - Add Student /n";
    cout<<"2 - Change Student Information /n";
    cout<<"3 - Delete Student /n";
    cout<<"4 - Print Student List /n;
    cout<<"Enter a Function Code /t Ctrl+z to stop /n";
    cin>>code;
    }

    void add_student(){
    Student * newstudent;
    newstudent= new Student;
    ///WHAT SHOULD I HAVE TO TAPE HERE!!!????}
  2. #2
  3. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    Please go to your instructor and/or classmates for help.
    It is frowned upon to come to a this community to get help for homework.

IMN logo majestic logo threadwatch logo seochat tools logo