fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. struct node{
  4. int data;
  5. node* left;
  6. node* right;
  7. node(int n){
  8. data =n;
  9. left=NULL;
  10. right =NULL;
  11. }
  12.  
  13. };
  14. int main() {
  15. // your code goes here
  16. node* temp = new node(5);
  17. temp->right = new node(6);
  18. temp->left= new node(7);
  19. cout<<temp->data<<" ";
  20. cout<<temp->left->data<<" ";
  21. cout<<temp->right->data<<" ";
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
5 7 6