关于二叉树输入数据的问题
#include<stdio.h>#include<stdlib.h>
#include<string.h>
typedef char TElemType;
typedef struct BiTNode
{
TElemType data;
struct BiTNode *Lchild;
struct BiTNode *Rchild;
}BiTNode,*BiTree;
void CreateBiTree(BiTree &root)
{
char ch;
ch=getchar();
if(ch=='#') root=NULL;
else
{
root=(BiTNode *)malloc(sizeof(BiTNode));
root->data=ch;
CreateBiTree(root->Lchild);
CreateBiTree(root->Rchild);
}
}
void main()
{
BiTree T;
CreateBiTree(T);
}
就像这样,我分别输入a(回车)#(回车)#(回车),但是怎么不停,还要继续输入?