#include<stdio.h>
#include<malloc.h>
#include<process.h>
#define Error 0
#define OK 1
typedef struct BiTNode
{
int data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
creatbittree(BiTree *t)
{
int ch;
printf("请输入值\n");
scanf("%d",&ch);
if(ch==' ')
{
*t=NULL;
}
else
{
*t=(BiTNode *)malloc(sizeof(BiTNode));
(*t)->data=ch;
creatbittree(&(*t)->lchild);
creatbittree(&(*t)->rchild);
}
}
main()
{
BiTree ptr;
printf("请按先序遍历的次序输入二叉树\n");
creatbittree(&ptr);
printf("啦啦啦啦\n");
}
#include<malloc.h>
#include<process.h>
#define Error 0
#define OK 1
typedef struct BiTNode
{
int data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
creatbittree(BiTree *t)
{
int ch;
printf("请输入值\n");
scanf("%d",&ch);
if(ch==' ')
{
*t=NULL;
}
else
{
*t=(BiTNode *)malloc(sizeof(BiTNode));
(*t)->data=ch;
creatbittree(&(*t)->lchild);
creatbittree(&(*t)->rchild);
}
}
main()
{
BiTree ptr;
printf("请按先序遍历的次序输入二叉树\n");
creatbittree(&ptr);
printf("啦啦啦啦\n");
}