头文件a.h: typedef struct node{ char data; struct node *lchild,*rchild; }bitnode,*bitree; /*定义二叉树的结点*/ bitree create(bitree t);/*先序构建二叉树*/ printft(bitree t);/*中序输出所构建的二叉树*/ a.cpp文件: #include<malloc.h> /*先序构建二叉树的函数*/ bitree create(bitree t) { char ch; ch=getchar(); if(ch=='#') t=NULL; else { t=(bitree)malloc(sizeof(bitnode)); t->data=ch; t->lchild=create(t->lchild); t->rchild=create(t->rchild); } return t; } /*中序输出所构建的二叉树*/ printft(bitree t) { if(t) { printft(t->lchild); printf("%c ",t->data); printft(t->rchild); } } main.cpp文件 #include <stdio.h> #include<malloc.h> #include <string.h> #include"a.cpp" int main(void) { bitree t; printf("请输入你想建立的二叉树(按照先序构造)并以#表示空:/n"); t&