#include
Typedef char Elemtype;
Typedef struct BiTNode
{
char data;
Struct lchild BiTNode * and * rchild;
} BiTNode, * BiTree;
//create a binary tree, agreed the user input data follow the preorder traversal of the
CreateBiTree (BiTree * T)
{
Char c;
The scanf (" % c ", & amp; C);
If (c==' ')
{
* T=NULL;
}
The else
{
* T=(BiTNode *) malloc (sizeof (BiTNode));
(* T) - & gt; data=https://bbs.csdn.net/topics/c;
CreateBiTree (& amp; (* T) - & gt; Lchild);
CreateBiTree (& amp; (* T) - & gt; Rchild);
}
}
//statistics the number of nodes in the binary tree T
Int NodeCount (BiTree T)
{
If (T==NULL)
{
return 0; Nodes is empty,//is the number of 0
}
The else
{
Return NodeCount (T - & gt; Lchild) + NodeCount (T - & gt; Rchild) + 1;//the realization of the recursive process
}
}
Int main ()
{
BiTree T=NULL;
CreateBiTree (& amp; T);
NodeCount (T);
return 0;
}