title: How to draw BST with recursion in this format?
body: <pre><code>void printGivenLevel(node *root, int level, int side, int x, int y)
  {
    if(root == NULL)
     return;
  
     if(level == 1)
     {
       gotoxy(x, y);
       cout &lt;&lt; root-&gt;data;
     }
     else if(level &gt; 1)
     {
        if(y&lt;=2)
        {
          printGivenLevel(root-&gt;left, level-1, 1, x-4, y);
          printGivenLevel(root-&gt;right,level-1, 2, x+4, y);
        }
        else
        {
          printGivenLevel(root-&gt;left, level-1, 1, x-2, y);
          printGivenLevel(root-&gt;right,level-1, 2, x+2, y);
        }
     }
  }
  void print(node *root)
   {
     int h = height(root);
     int i;
     int side = 0; // Use 1 for left and 2 for right 
     int x = 42; //42 is the center of console
  
     for(i=1;i&lt;=h;i++)
     {
       printGivenLevel(root, i, side, x, i);
       cout &lt;&lt; endl;
     }
  
    }
  </code></pre>
  
  <p>I am using c++ and need the BST like this <a href="https://i.stack.imgur.com/6imof.png" rel="nofollow noreferrer">output</a>
  .The code above can only format up to level 1. I didn't include the underscore yet because I was trying to fix the spaces first. I'm looking for a way to format this without using anything too complicated like queues and I'm also using turbo c++ any help will be appreciated. Thanks</p>