What’s the error in my code?
I Can’t able to print “Right Sub Trees”
#include 
using namespace std;
class node
{
public:
int data;
nodeleft;
noderight;
  node(int d)
  {
    data=d;
    left=NULL;
    right=NULL;
  }
};
node *buildTree()
{
int d;
cin>>d;
//To end node we send -1 as NULL input
if(d==-1)
{
    return NULL;
}
node*root = new node(d);
root->left=buildTree();
root->right=buildTree();
return root;
}
void printPreOrder(node*root)
{
if(root==NULL)
{
return;
}
//Otherwise, Print Root First Followed By Sub-Trees(Children)
//Root->Left->Right
cout<data<<" ";
//Making Recursive Calls To Print
printPreOrder(root->left);
printPreOrder(root->right);
}
void printInOrder(node*root)
{
if(root==NULL)
{
return;
}
//Otherwise Left->Root->Right
printInOrder(root->left);
cout<data<<" ";
printInOrder(root->right);
}
void printPostOrder(node*root)
{
if(root==NULL)
{
return;
}
//Otherwise Left->Right->Root
printPostOrder(root->left);
printPostOrder(root->right);
cout<data<<" ";
}
int main()
{
node*root=buildTree();
printPreOrder(root);
cout<<endl;
printInOrder(root);
cout<<endl;
printPostOrder(root);
cout<<endl;
}
