主题:帮我看看,刚学二叉树
#include<stdlib.h>
#include<iostream.h>
#include<malloc.h>
#include<string.h>
#include<stdio.h>
enum Status {OVERFLOW,OK};
typedef int TElemType ;
typedef struct BiTNode{
TElemType data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
Status CreateBiTree_PreOrder(BiTree&T)
{
char ch;
cin>>ch;
if(ch==' ')T=NULL;
else{
if(!(T=(BiTNode*)malloc(sizeof(BiTNode))))
exit(OVERFLOW);
T->data=ch;
CreateBiTree_PreOrder(T->lchild);
CreateBiTree_PreOrder(T->rchild);
}
return OK;
}
void main()
{
#include<iostream.h>
#include<malloc.h>
#include<string.h>
#include<stdio.h>
enum Status {OVERFLOW,OK};
typedef int TElemType ;
typedef struct BiTNode{
TElemType data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
Status CreateBiTree_PreOrder(BiTree&T)
{
char ch;
cin>>ch;
if(ch==' ')T=NULL;
else{
if(!(T=(BiTNode*)malloc(sizeof(BiTNode))))
exit(OVERFLOW);
T->data=ch;
CreateBiTree_PreOrder(T->lchild);
CreateBiTree_PreOrder(T->rchild);
}
return OK;
}
void main()
{