Trees traversal leval wise in zig zag manner

#195542 this is a code.
i am not able to think how can i give true or false in input.

Given a binary tree. Print the zig zag order i.e print level 1 from left to right, level 2 from right to left and so on. This means odd levels should get printed from left to right and even levels should be printed from right to left. Each level should be printed at a new line.

Input Format
Enter the values of all the nodes in the binary tree in pre-order format where true suggest the node exists and false suggests it is NULL

Constraints
None

Output Format
Display the values in zigzag level order in which each value is separated by a space

Sample Input
10 true 20 true 40 false false true 50 false false true 30

node* buildTreeLevelWise(){

int d;
cin>>d;

noderoot = new node(d);
queue<node
> q;
q.push(root);

while(!q.empty()){

  node*f = q.front();
  q.pop();
  string c1,c2;
  cin>>c1>>c2;

  if(c1!="false"){
  	f->left = new node(stoi(c1));
  	q.push(f->left);
  }
  if(c2!="false"){
  	f->right = new node(stoi(c2));
  	q.push(f->right);
  }

}
return root;
}

This buildTree function would do the work of dealing with the true and false criteria

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.