#include <stdio.h>
#define MAX_STACK_SIZE 100
#define ERROR 0
#define OK 1
typedef int ElemType;
typedef int Status;
#define MAX_QUEUE_SIZE 100
#define max_strlen 256
#define MAX_SIAE 100
#define MAX_NODE 50
//二叉树的结构
typedef ElemType sqbitree[MAX_SIAE];
//用一组地址连续的存储单元依次“自上而下、自左 至右”存储完全二叉树的数据元素
typedef struct BTNode
{
char data;
struct BTNode *Lchild,*Rchild; //左右结点
}BTNode;
BTNode *Create_BTree(void) //返回根节点的指针
{
BTNode *T,*p;
BTNode *s[MAX_NODE];
char ch;
int i,j;
while(1)
{
scanf("%d",&i);
if(i==0)
break;
else
{
ch = getchar();
printf("%c",ch);
p = (BTNode *)malloc(sizeof(BTNode));
p->Lchild = p->Rchild = NULL;
p->data = ch;
s[i] = p;
if(i==1)
T = p;
else
{
j = i/2; //j是i的双亲节点编号
if(i%2==0)
s[j]->Lchild = p;
else
s[j]->Rchild = p;
}
}
}
return (T);
}
int main()
{
BTNode *T;
T = Create_BTree();
printf("%c",T->Rchild->data);
return 0;
}
输入格式:1A2B3C……