title: Add method not returning any values
body: <p>I am writing an add method for a Linked List class in C++. The add method is written to handle a variety of situations that may occur based on the input of the method.  I have added "cout" statements in order to try and track which loops/if-statements the method is going into, but nothing is being printed from the method.  The input for the method are the index of the node and the data that is held in the node.  </p>
  
  <pre><code>void linkedList::add(int pos, string item)
  {
      Node *temp = new Node;
      Node *nextTemp = new Node;
  
      if(pos == 0)
      {
          cout&lt;&lt; "hey";
          if(head != NULL)
          {
              cout&lt;&lt; "hey1";
              temp-&gt;setData((head-&gt;getPosition()+1), 
                      head-&gt;getItem(), head-&gt;getNextNode());
              head-&gt;setData(pos, item, temp);
              currentNode = head;
              size++;
          }
          else
          {
              cout&lt;&lt; "hey2";
              head-&gt;setData(pos, item, temp);
              currentNode = head;
              size++;
          }
      }
      else if(pos == size)
      {
          cout&lt;&lt; "hey3";
          while(currentNode != NULL)
          {
              cout&lt;&lt; "hey4";
              currentNode = currentNode-&gt;nextNode;
          }
          temp-&gt;setData(pos, item, nextTemp);
          currentNode-&gt;nextNode = temp;
          size++;
      }
  
      else
      {
          cout&lt;&lt; "hey5";
          for(int i = 0; i&lt;size; i++)
          {
              cout&lt;&lt; "hey6";
              if(i == currentNode-&gt;getPosition())
              {
                  cout&lt;&lt; "hey7";
                  temp-&gt;setData(currentNode-&gt;getPosition(), 
                          currentNode-&gt;getItem(), currentNode-&gt;getNextNode());
                  currentNode-&gt;setData(pos, item, temp);
                  size++;
              }
  
              currentNode = currentNode-&gt;nextNode;
              while(currentNode-&gt;getPosition() &lt; (size+1))
              {
                  cout&lt;&lt; "hey8";
                  currentNode-&gt;setPosition(i+1);
                  currentNode = currentNode-&gt;nextNode;
              }
          }
      }
  }
  </code></pre>
  
  <p>Any help would be appreciated. Thank you. </p>