How to make a tree

please help to make a tree out of the input given

Hi Kushagra, you can use a buildtree function like this:

node * buildtree(node* root, bool ilc) //ilc means is left child which will be false initially
{
int cdata; //cdata is child data
cin>>cdata;
node * child= new node(cdata);

		// left
		string hlc; //hlc means has left child
        cin>>hlc;

		if (hlc=="true") {
			child->left = buildtree(child,true);
		}

		// right
        string hrc; //has right child
        cin>>hrc;

		if (hrc=="true") {
			child->right = buildtree(child,false);
		}

		// return
		return child;

}