Implementaion of the code

i am not getting how to take the input and print the output…in the video how sir is running the code without taking the input

please reply…i am not getting the further videos input and output due to this doubt

please reply pleaseeeeeee

hi @abhinavssr2003_eab0717682969e5c u can take input the same way he coded in prev videos, here he just coded the function

i tried but i am not getting the output…will you please give me screenshots of how to take

Like we take the output earlier with the buildtree…but suddenly he used cin and cout but i am not getting how to ston taking the input

please brief me well…
void levelorderbuild(node *&root)

{

int d;

cin >> d;

root = new node(d);

queue<node *> q;

q.push(root);

while (!q.empty())

{

    node *f = q.front();

    q.pop();

    int c1, c2;

    cin >> c1 >> c2;

    if (c1 != -1)

    {

        f->left = new node(c1);

        q.push(f->left);

    }

    if (c2 != -1)

    {

        f->right = new node(c2);

        q.push(f->right);

    }

}

}

hi @abhinavssr2003_eab0717682969e5c what u wanna ask here?
this is level order traversal building of tree

my doubt is like in his earlier videos…he was taking input with the help of buldingtree function…in this function what is c1 and c2 and i want the method of taking the input…My only doubt is please explain me(cin>>root)

hi @abhinavssr2003_eab0717682969e5c
refer this

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.