#include<stdio.h>
#define LEN sizeof(struct BiNode)
struct BiNode
{
int data;
struct BiNode * lchild, * rchild;
} ;
struct BiNode * Creat()
{
int ch;
struct BiNode *root;
scanf("%d",&ch);
if (ch=='#') return NULL;
else{
root=(struct BiNode *)malloc(LEN);
root->data = ch;
root->lchild = Creat();
root->rchild = Creat();
}
return root;
}
void preorder(struct BiNode *bt)
{
if(bt!=NULL)
{
printf("%d\t",bt->data);
preorder(bt->lchild);
preorder(bt->rchild);
}
}
void cpreorder(struct BiNode *bt)
{
if(bt!=NULL)
{
inorder(bt->lchild);
printf("%d\t",bt->data);
inorder(bt->rchild);
}
}
void postorder(struct BiNode *bt)
{
if(bt!=NULL)
{
postorder(bt->lchild);
postorder(bt->rchild);
printf("%d\t",bt->data);
}
}
void main()
{
struct BiNode *root;
int a;
clrscr();
do
{
printf("1.Creat 2.preorder 3.cpreorder 4.postorder 5.exit\nPlease input select:");
scanf("%d",&a);
if(a==1) { root=Creat(); }
if(a==2) { preorder (root);}
if(a==3) { cpreorder(root); }
if(a==4) { postorder(root); }
if(a==5) exit(0);
}while(1);
}
错误提示::Underfined symbol _inorder in module yanzhe~2.c