title: c++ returning a single value from a linked list
body: <p>I have the following code but it gives an error on the line - e = list.first();(towards the end of the code). It says that it cannot convert Node to char can someone tell me how to get return the first value from the linked list in the variable e. </p>
  
  <p>Thanks for all the help:)</p>
  
  <pre><code>//
  //  main.cpp
  //  cprogram1
  //
  
  #include &lt;iostream&gt;
  
  using namespace std;
  class Node {
      char data;
      Node* next;
  
  public:
      Node() {};
      void SetData(int aData) { data = aData; };
      void SetNext(Node* aNext) { next = aNext; };
      char Data() { return data; };
      Node* Next() { return next; };
  };
  
  // List class
  class List {
      Node *head;
  public:
      List() { head = NULL; };
      void Print();
      void Append(int data);
      void Delete(int data);
      Node * First() const;
  };
  
  /**
   * Print the contents of the list
   */
  void List::Print() {
  
      // Temp pointer
      Node *tmp = head;
  
      // No nodes
      if ( tmp == NULL ) {
          cout &lt;&lt; "EMPTY" &lt;&lt; endl;
          return;
      }
  
      // One node in the list
      if ( tmp-&gt;Next() == NULL ) {
          cout &lt;&lt; tmp-&gt;Data();
          cout &lt;&lt; " --&gt; ";
          cout &lt;&lt; "NULL" &lt;&lt; endl;
      }
      else {
          // Parse and print the list
          do {
              cout &lt;&lt; tmp-&gt;Data();
              cout &lt;&lt; " --&gt; ";
              tmp = tmp-&gt;Next();
          }
          while ( tmp != NULL );
  
          cout &lt;&lt; "NULL" &lt;&lt; endl;
      }
  }
  
  /**
   * Append a node to the linked list
   */
  void List::Append(int data) {
  
      // Create a new node
      Node* newNode = new Node();
      newNode-&gt;SetData(data);
      newNode-&gt;SetNext(NULL);
  
      // Create a temp pointer
      Node *tmp = head;
  
      if ( tmp != NULL ) {
          // Nodes already present in the list
          // Parse to end of list
          while ( tmp-&gt;Next() != NULL ) {
              tmp = tmp-&gt;Next();
          }
  
          // Point the last node to the new node
          tmp-&gt;SetNext(newNode);
      }
      else {
          // First node in the list
          head = newNode;
      }
  }
  
  /**
   * Delete a node from the list
   */
  void List::Delete(int data) {
  
      // Create a temp pointer
      Node *tmp = head;
  
      // No nodes
      if ( tmp == NULL )
          return;
  
      // Last node of the list
      if ( tmp-&gt;Next() == NULL ) {
          delete tmp;
          head = NULL;
      }
      else {
          // Parse thru the nodes
          Node *prev;
          do {
              if ( tmp-&gt;Data() == data ) break;
              prev = tmp;
              tmp = tmp-&gt;Next();
          } while ( tmp != NULL );
  
          // Adjust the pointers
          prev-&gt;SetNext(tmp-&gt;Next());
  
          // Delete the current node
          delete tmp;
  
      }
  }
  
  Node * List::First() const {
      Node *tmp = head;
      return head;
  }
  
  int main ()
  {
      char c;
      int t = 0;
      char e;
      List list;
      while(t==0)
      {
          cout &lt;&lt; "Please enter your command";
          cin &gt;&gt; c;
          if(c=='c')
          {
              cout &lt;&lt; "You will need to enter 6 letters, one after the other";
              cout &lt;&lt; "Please enter the first letter";
              cin &gt;&gt; e;
              list.Append(e);
              cout &lt;&lt; "Please enter the second letter";
              cin &gt;&gt; e;
              list.Append(e);
              cout &lt;&lt; "Please enter the third letter";
              cin &gt;&gt; e;
              list.Append(e);
              cout &lt;&lt; "Please enter the fourth letter";
              cin &gt;&gt; e;
              list.Append(e);
              cout &lt;&lt; "Please enter the fifth letter";
              cin &gt;&gt; e;
              list.Append(e);
              cout &lt;&lt; "Please enter the sixth letter";
              cin &gt;&gt; e;
              list.Append(e);
              list.Print();
              list.Delete('b');
              list.Print();
              e = list.First();
  
  
          }
      }
  }
  </code></pre>