title: Remove space from last number in C++
body: <p>I trying to write a program about reconstruct a binary search tree from inorder and preorder traversal, then output the tree into postorder , I need to remove blank space after the last element from my tree is printed, but I not really sure how to do it.</p>
  <p>My postorder code:</p>
  <pre><code>    void postorder(Node* root) 
  {
      if (root == nullptr) {
          return;
      }
      postorder(root-&gt;left);
      postorder(root-&gt;right);
      cout &lt;&lt; root-&gt;data &lt;&lt; &quot; &quot;;
  }
  </code></pre>
  <p>Suppose output is 4_5_2_3_1, where _ is blank space between numbers (&quot; &quot;), but now my output is 4_5_2_3_1_ (an extra space after 1), how can I remove it?</p>