// 080511202.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
typedef struct BITree{ //二叉树链式结构
char data;
struct BITree *lc; //左子树
struct BITree *rc; //右子树
}BINode,*list;
int Creat(list *root){ //创建一棵二叉树
char n;
scanf("%c",&n);
if (n=='0') //0为间隔
{
*root=NULL; return 0; //输入结束
}
*root=(list)malloc(sizeof(BITree));
if (!*root) return 0;
(*root)->data=n;
Creat(&(*root)->lc);
Creat(&(*root)->rc);
return 1;
}
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载