title: Linked Lists C++, output not showing in display function
body: <pre><code>#include &lt;string&gt;
  
  using namespace std;
  
  class PersonList
  {
  
  private:
      char aName[7];
      int aBribe;
      PersonList *link;
  
  public:
      void addNodes();
      void display();
  
  };
  
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  #include "mylink.h"
  
  void PersonList::addNodes()
  {
  
      PersonList *temp2;
  
      PersonList* startPtr = new PersonList();
      PersonList* current = new PersonList();
  
  
          PersonList *temp = new PersonList();//created the first node on the list
          cout&lt;&lt;"Enter the person's name: ";
          cin&gt;&gt;temp-&gt;aName;
          cout&lt;&lt;"Enter the person's contribution: ";
          cin&gt;&gt;temp-&gt;aBribe;
          temp-&gt;link=NULL;//when i get last node, link will point to null(where am i in list?)
  
          if(startPtr==NULL)
          {
              startPtr = temp;
              current = startPtr;
          }
  
          else
          {
              temp2 = startPtr;
  
              while(temp2-&gt;link!=NULL)
                  temp2 = temp2-&gt;link;
              temp2-&gt;link=temp;
          }
      //}
  }
  
  void PersonList::display()
  {
      PersonList *temp;
      PersonList *startPtr = this;
  
      temp=startPtr;
  
      while(temp != NULL)
      {
          cout&lt;&lt;temp-&gt;aName&lt;&lt;"\t\t"&lt;&lt;temp-&gt;aBribe&lt;&lt;endl;
          temp = temp-&gt;link;
      }
  
  }
  
  #include &lt;iostream&gt;
  #include "mylink.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.addNodes();
  break;
  case 2: p.display();
  break;
  }
  
  }
  </code></pre>
  
  <p>My question is the display function is not displaying name and contribution that I enter.
  Im using temp variable as a pointer node to call aName and aBribe.  This goes through the list while it has not reached null.  Nothing shows in output</p>