CodePudding user response:
#include#include
using namespace std;
Struct BiTreeNode
{
Char data;
Struct rchild BiTreeNode * and * lchild;
};
The class BiTree
{
Public:
Void the Create (struct BiTreeNode *);
void Display();
};
Void BiTree: : Create (struct BiTreeNode * Tnode)
{
char ch;
Cin> Ch;
If (ch==' ')//space said empty tree
{
Tnode=NULL;
}
The else
{
Tnode=(struct BiTreeNode *) malloc (sizeof (struct BiTreeNode));
Tnode - & gt; data=https://bbs.csdn.net/topics/ch;
Create (Tnode - & gt; Lchild);
Create (Tnode - & gt; Rchild);
}
cout<" The Create Complated!" & lt; & lt; Endl;
}
Int main ()
{
Struct BiTreeNode * Tnode;
BiTree BT1;
BT1. Create (Tnode);
return 0;
}