Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Setting up a linked list? (http://www.go4expert.com/forums/setting-linked-list-t26936/)

deker9 14Oct2011 23:42

Setting up a linked list?
I'm reading a text file into the program with the following format:

Becker John P
Ury Ismael C
Joker Samuel P
Sampson Kelly C

My code is below:

struct Roster {
    string LName;
    string FName;
    char Cheesecake;
    Roster *next, *prev;


    Roster * head;

    for (int record = 0;record < numRecords;record++)
            static Roster * thisRoster = new struct Roster;
            inFile >> thisRoster->LName;
            inFile >> thisRoster->FName;
            inFile >> thisRoster->Cheesecake;
            cout << (*thisRoster).LName << " " << (*thisRoster).FName << " " << (*thisRoster).Cheesecake << endl;


My issue is that I'm not sure how to "link" these together. I'm then supposed to be able to sort by last name etc. Can someone maybe give me pointers or help me modify this code to suit those purposes?

neerjasoftwares 19Oct2011 12:16

Re: Setting up a linked list?
hello dear.....................
Neerja Softwares.com launched a quick series on pointers giving the explanation of each and every topic that we face daily.

All times are GMT +5.5. The time now is 05:53.