I used preorder traversal to create a binary tree,and set to type \'9999\' to end the input:
void createbt(btree& t) { int ch; cin >> ch;