|  | 
 
| 
x
马上注册,结交更多好友,享用更多功能^_^您需要 登录 才可以下载或查看,没有账号?立即注册  #include<iostream>
 int sum = 0;
 using namespace std;
 struct BiNode {
 int    data;
 BiNode* lchild, * rchild;
 };
 class  BiTree
 {
 public:
 BiTree() { root = creat(root); }
 ~BiTree();
 void inOrder() { inOrder(root); }
 private:
 BiNode* root;
 private:
 BiNode* creat(BiNode* bt);
 void inOrder(BiNode* bt);
 };
 BiNode* BiTree::creat(BiNode* bt) {
 char ch;
 ch = getchar();
 if (ch == ',')
 ch = getchar();
 
 if (ch == '#')
 bt = NULL;
 else
 {
 bt = new BiNode;
 bt->data =ch;  这个地方读入时只读入两位数的一位怎么解决?输入数据是这样的:3,9,#,#,20,15,#,#,7,#,#
 bt->lchild = creat(bt->lchild);
 bt->rchild = creat(bt->rchild);
 }
 return bt;
 }
 | 
 |