Language: C++

#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

struce Node {
  int key;
  Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k) {
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while ( x != NIL ) {
    y = x;
    if ( z->key < x->key ) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  z->parent = y;

  if ( y == NIL ) {
    root = z;
  } else {
    if ( z->key < y->key ) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node *u){
  if ( u == NIL ) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node *u) {
  if ( u == NIL ) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n, i, x;
  string com;

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    cin >> com;
    if ( com == "insert" ) {
      scanf("%d", &x);
      insert(x);
    } else if ( com == "print" ) {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}


Compiler output:
a.cc:7:1: error: 'struce' does not name a type; did you mean 'struct'?
    7 | struce Node {
      | ^~~~~~
      | struct
a.cc:12:1: error: 'Node' does not name a type
   12 | Node *root, *NIL;
      | ^~~~
a.cc: In function 'void insert(int)':
a.cc:15:3: error: 'Node' was not declared in this scope
   15 |   Node *y = NIL;
      |   ^~~~
a.cc:15:9: error: 'y' was not declared in this scope
   15 |   Node *y = NIL;
      |         ^
a.cc:15:13: error: 'NIL' was not declared in this scope
   15 |   Node *y = NIL;
      |             ^~~
a.cc:16:9: error: 'x' was not declared in this scope
   16 |   Node *x = root;
      |         ^
a.cc:16:13: error: 'root' was not declared in this scope
   16 |   Node *x = root;
      |             ^~~~
a.cc:17:9: error: 'z' was not declared in this scope
   17 |   Node *z;
      |         ^
a.cc:19:14: error: expected primary-expression before ')' token
   19 |   z = (Node *)malloc(sizeof(Node));
      |              ^
a.cc: At global scope:
a.cc:45:6: error: variable or field 'inorder' declared void
   45 | void inorder(Node *u){
      |      ^~~~~~~
a.cc:45:14: error: 'Node' was not declared in this scope
   45 | void inorder(Node *u){
      |              ^~~~
a.cc:45:20: error: 'u' was not declared in this scope
   45 | void inorder(Node *u){
      |                    ^
a.cc:52:6: error: variable or field 'preorder' declared void
   52 | void preorder(Node *u) {
      |      ^~~~~~~~
a.cc:52:15: error: 'Node' was not declared in this scope
   52 | void preorder(Node *u) {
      |               ^~~~
a.cc:52:21: error: 'u' was not declared in this scope
   52 | void preorder(Node *u) {
      |                     ^
a.cc: In function 'int main()':
a.cc:71:15: error: 'root' was not declared in this scope
   71 |       inorder(root);
      |               ^~~~
a.cc:71:7: error: 'inorder' was not declared in this scope
   71 |       inorder(root);
      |       ^~~~~~~
a.cc:73:7: error: 'preorder' was not declared in this scope
   73 |       preorder(root);
      |       ^~~~~~~~