为什么写完这个程序,成功运行之后,输入完数据按enter键不继续运行了而是换行?谁能给我解答一下
#include<stdio.h>
#define _CRT_SECURE_NO_WARNINGS
typedef struct BiTNode
{
char data;
struct BiTNode* lchild, * rchild;
}BiTNode, * BiTree;
void CreateBiTree(BiTree &T)
{
char ch;
scanf_s("%c",&ch,20);
if (ch == '#')
T= NULL;
else
{
T =new BiTNode;
T->data = ch;
CreateBiTree(T->lchild);
CreateBiTree(T->rchild);
}
}
int Depth(BiTree T)
{
int m=0 , n=0;
if (T == NULL)
return 0;
else
{
m = Depth(T->lchild);
n = Depth(T->rchild);
if (m > n)
return (m + 1);
else
return(n + 1);
}
}
int NodeCount(BiTree T)
{
if (T == NULL)
return 0;
else
return NodeCount(T->lchild) + NodeCount(T->rchild) + 1;
}
void main()
{
BiTree T;
printf("先序序列输入二叉树中的各结点(空树以#代替):");
CreateBiTree(T);
printf("树的深度为: %d\n", Depth(T));
printf("树中的结点数: %d\n", NodeCount(T));
}