Code is not executing

#include
using namespace std;
class node{
public:
int data;
node *left;
node *right;

   node(int d)
   {
    data=d;
    left=NULL;
    right=NULL;
   }

};
node *builtTree()
{
int d;
cin>>d;
if(d==-1)
{
return NULL;
}
node *root=new node(d);
root->left = builtTree();
root->right = builtTree();
return root;
}
void preorder(node *root)
{
if(root==NULL)
{
return;
}
cout<data<<" “;
preorder(root->left);
preorder(root->right);
}
void printrightView(node *root,int level,int &maxlevel)
{
if(root==NULL)
{
return ;
}
if(maxlevel<level)
{
cout<data<<” ";
maxlevel=level;
}
printrightView(root->right,level+1,maxlevel);
printrightView(root->left,level+1,maxlevel);
}

int main()
{

node *root=builtTree();
// preorder(root);
// cout<<endl;
 int maxlevel=-1;
printrightView(root,0,maxlevel);

}

hi @itzzeeshu5 use this build method else code is correct

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.