title: Binary Search Tree reading in Strings? C++
body: <p>I have a project that is due Monday night. The project is to implement a Red Black Tree that reads in the declaration of Independence as "Independence.txt" and puts those strings into a red black tree. I am trying to implement it as a Binary Search Tree first and then will add the colors and the rotations as I already have that code worked out. </p>
  
  <p>The problem I am facing is that right now I keep getting the following errors: "error C2660" 'RBT ::Insert': function does not take 1 arguments" and "IntelliSense: non suitable conversion function from "std:string" to "RBT::RBTNode *" exists" and then IntelliSense: too few arguments in function call which points to the line root.Insert(myString); </p>
  
  <p>I also need help with reading in the file into the binary search tree. I do think my insert method is correct, and the problem lies in the main method. </p>
  
  <p>Thanks for any help as I am stuck. </p>
  
  <pre><code>#include "stdafx.h" 
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt; 
  
  using namespace std; 
  
  template&lt;typename T&gt;
  class RBT
  {
      struct RBTNode {
          T data;
          RBTNode* left;
          RBTNode* right;
      };
  
  public:
      RBT();
      ~RBT();
      void GetNewNode(RBTNode* root, T data);
      void Insert(RBTNode* root, T data);
      bool Search();
      void Display();
  
  };
  
  
  template &lt;typename T&gt;
  void RBT&lt;T&gt;::GetNewNode(RBTNode* root, T data) {
      RBTNode* newNode = new RBTNode();
      newNode-&gt;data = data;
      newNode-&gt;left = newNode-&gt;right = NULL;
      return newNode;
  }
  
  template &lt;typename T&gt;
  void RBT&lt;T&gt;::Insert(RBTNode* root, T data) {
      if (root == NULL) {
          root = GetNewNode(data);
      }
      else if (data &lt;= root-&gt;data) {
          root-&gt;left = Insert(root-&gt;left, data);
      }
      else {
          root-&gt;right = Insert(root-&gt;right, data);
      }
      return root;
  } 
  
  template&lt;typename T&gt;
  bool RBT&lt;T&gt;::Search() {
      if (root == NULL) return false;
      else if (root-&gt;data == data) return true;
      else if (data &lt;= root-&gt;data) return Search(root-&gt;left, data);
      else return Search(root-&gt;right, data);
  }
  
  template&lt;typename T&gt;
  void RBT&lt;T&gt;::Display() {
      if (root-&gt;left != NULL)
          display(root-&gt;left);
      cout &lt;&lt; root-&gt;left &lt;&lt; endl;
  
      if (root-&gt;right != NULL)
          Display(root-&gt;right);
      cout &lt;&lt; root-&gt;right &lt;&lt; endl;
  }
  
  
  
  int main()
  {
      RBT&lt;string&gt; root;
      string myString; 
      ifstream infile; 
      infile.open("Independence.txt"); 
      while (infile)
      {
          infile &gt;&gt; myString; 
          root.Insert(myString); 
      }
  
      cin.ignore();
      return 0;
  }
  </code></pre>