How to write code to input values according to the value of boolean variable i.e true/false?

As given in this question’s example.The input is given using true and false.But in the videos ,it was done by using -1.

hi @divyanshinegi2003_987b3f0f92dd8c0c,

void takeinput(BinaryNodeTree<int>* &root){
	string left1,right1;
	int d;
	cin>>d;
	root = new BinaryNodeTree<int>(d);

	cin>>left1;
	if(left1 == "true"){
		takeinput(root->left);
	}
	cin>>right1;
	if(right1 == "true"){
		takeinput(root->right);
	}
}

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.