title: c++ trying to find the distance between 2 nodes
body: <p>I am currently working on a function that has 1 helper function, the main function takes in 2 strings and searches for the first one (which becomes a reference as if it was m_root) and a second one to be searched in the tree.  once they are searched, my helper function is supposed to search for the 2nd city and count the distance it had to travel as if a truck was going towards that city.</p>
  
  <pre><code>    int Stree::distance(string origin_city, string destination_city)
  {
      int total_distance = 0;
      Node *new_root = m_root;
      new_root = find_node(m_root, origin_city);
      total_distance = get_distance(new_root, total_distance, destination_city);
      return total_distance;
  }
  
  int Stree::get_distance(Node* cur, int distance, string destination)
  {
      Node *tmp = cur;
      if(cur == NULL)
          return 0;
      if(cur-&gt;m_city == destination || tmp-&gt;m_city == destination)
      {
          //cout &lt;&lt; distance + cur-&gt;m_parent_distance &lt;&lt; endl;
          return distance += cur-&gt;m_parent_distance;
      }
      if(tmp-&gt;m_left != NULL)
      {
          //cout &lt;&lt; "checking left" &lt;&lt; endl;
          tmp = cur-&gt;m_left;
          return get_distance(cur-&gt;m_left, distance, destination) ;
      }
      else
      {
          //cout &lt;&lt; "checking right" &lt;&lt; endl;
          return get_distance(cur-&gt;m_right, distance, destination);
      }
  }
  </code></pre>