My linked lists program works, but it wont show all of the list
<p>My linked lists program works, but it wont show all of the list</p>

<p>here is my code
When the user enters a name and contribution it stores it in the list.  When i print out the list only the last name that the user entered showed.  I think its in my AddToList function is the problem  Thanks</p>

<pre><code>#include &lt;string&gt;

using namespace std;

struct PersonRec
{
    char aName[20];
    //string aName;
    int aBribe;
    PersonRec* link;
};


class PersonList
{

private:
    PersonRec *head;
    bool IsEmpty();


public:
    PersonList();
    ~PersonList();
    void AddToList();
    void ViewList();

};

#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

#include "personlist.h"

PersonList::PersonList()
{
    head = NULL;
}

PersonList::~PersonList()
{
    PersonRec *current, *temp;
    current = head;
    temp = head;
    while(current != NULL)
    {
        current = current-&gt;link;
        delete temp;
        temp = current;
    }
}


bool PersonList::IsEmpty()
{
    //PersonRec *p;

    if(head == NULL)//it has no nodes head will poin to NULL
    {
        return true;
    }

    else
    {
        //p = head;
        return false;
    }
}


void PersonList::AddToList()
{
    PersonRec *p;


    head = new PersonRec();   

    //if(head == NULL)
    //{
    if(!IsEmpty())
    {
        //head = new PersonRec();

        cout&lt;&lt;"Enter the person's name: ";
        cin.getline(head-&gt;aName, 20);
        //cin&gt;&gt;head-&gt;aName;
        cout&lt;&lt;"Enter the person's contribution: ";
        cin&gt;&gt;head-&gt;aBribe;
        //head-&gt;link = NULL;
        //}
    }    

    else
    {
        p = head;
        while(p-&gt;link != NULL)
            p = p-&gt;link;
        p-&gt;link = new PersonRec();
    }


}//end function

void PersonList::ViewList()
{
    PersonRec *p;
    p = head;

    if(IsEmpty())
    {
        cout&lt;&lt;"List is Empty "&lt;&lt;endl;
    }

    while(p != NULL)
    {
        cout&lt;&lt;p-&gt;aName&lt;&lt;" "&lt;&lt;"$"&lt;&lt;p-&gt;aBribe&lt;&lt;endl;
        p = p-&gt;link;
    }

}

#include &lt;iostream&gt;
#include "personlist.h"

using namespace std;

int displayMenu (void);
void processChoice(int, PersonList&amp;);

int main()
{
    int num;

    PersonList myList;
    do 
    {
        num = displayMenu();
        if (num != 3)
            processChoice(num, myList);
    } while (num != 3);

    return 0;
}

int displayMenu(void)
{
    int choice;
    cout &lt;&lt; "\nMenu\n";
    cout &lt;&lt; "==============================\n\n";
    cout &lt;&lt; "1. Add student to waiting list\n";
    cout &lt;&lt; "2. View waiting list\n";
    cout &lt;&lt; "3. Exit program\n\n";
    cout &lt;&lt; "Please enter choice: ";
    cin &gt;&gt; choice;

    cin.ignore();
    return choice;
}

void processChoice(int choice, PersonList&amp; p)
{
    switch(choice)
    {
    case 1: p.AddToList();
        break;
    case 2: p.ViewList();
        break;
    }

}
</code></pre>
