// the old version for reference StringTree * insert(StringTree * t, string s) { if (t==NULL) t = new StringTree(s); else if (s <= t->data) t->left = insert(t->left, s); else t->right = insert(t->right, s); return t; } ... void insert(StringTree * & t, string s) { if (t==NULL) t = new StringTree(s); else if (s <= t->data) insert(t->left, s); else insert(t->right, s); } ... ... if (command=="i") { string operand; cin >> operand; insert(tree, operand); cout << operand << " inserted\n"; } ...