返回信息流编译通过,运行出错。请高手指教,谢谢。
#include <iostream>
using namespace std;
#define OVERFLOW 1
typedef struct BiTNode {
char data;
struct BiTNode *lchild, *rchild;
}BiTNode, *BiTree;
typedef struct Tree{
BiTree head;
int node_total;
int depth;
}Tree,*TreePtr;
int InitTree(TreePtr T);
int CreatTree(BiTree T);
int main ()
{
cout<<"Please input the tree:"<<endl;
TreePtr T;
InitTree(T);
system("pause");
return 0;
}
int InitTree(TreePtr T)
{
CreatTree(T->head);
cout<<T->head->data<<endl;
}
int CreatTree(BiTree T)
{
char node;
cin>>node;
if (node=='*'){
return 0;
T=NULL;
}
else {
T=new BiTNode;
if (!T)
exit(OVERFLOW);
T->data=node;
int m,n;
CreatTree(T->lchild);
CreatTree(T->rchild);
}
return 1;
}
这是一条镜像帖。来源:北邮人论坛 / cpp / #16179同步于 2008/11/17
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖
结构与指针问题,谢谢大家指点
Windmoon
2008/11/17镜像同步4 回复
订阅后,新回复会通过你的通知中心匿名送达。
4 条回复
可能是create出错了
【 在 Windmoon (天天) 的大作中提到: 】
: 编译通过,运行出错。请高手指教,谢谢。
: #include <iostream>
: using namespace std;
: ...................