#include<stdio.h>
#include<malloc.h>
#define null 0
#define M 30
typedef struct btreenode
{
char data;
struct btreenode *lc,*rc;
}jd;
jd *creattree()
{
jd *p;
char m;
scanf("%c",&m);
if(m==' ') p=null;
else
{
p=(jd*)malloc(sizeof(jd));
p->data=m;
p->lc=creattree();
p->rc=creattree();
}
return(p);
}
void output(jd *s,char n)
{
if(s!=null&&s->data!=n)
{
printf("%c ->",s->data);
output(s->lc,n);
output(s->rc,n);
}
else if(s!=null&&s->data==n)
printf("%c",s->data);
}
void main()
{
jd *tree;
char n;
printf("请先序输入二叉树\n");
tree=creattree();
printf("请输入你要查找的节点:\n");
n=getchar(); //此处的输入函数无响应//
printf("%c\n",n);
output(tree,n);
}