#include<iostream>
#include<queue>
using namespace std;
//struct BinTreeNode;
//struct BinTreeNode * pNode;
struct BinTreeNode
{
char data;
BinTreeNode* Lchild,* Rchild;
}*pNode;
typedef BinTreeNode * BinTree;
queue<BinTreeNode*>A;
queue<BinTreeNode*>B;
BinTree createTree(BinTree root,char X)
{
cout<<"按层次顺序输入二叉树节点(孩子为空的时候用'.'来表示,结束符为'#'):";
cin>>X;
while(X!='#')
{
pNode=new BinTreeNode();
pNode->data=X;
pNode->Lchild=NULL;
pNode->Rchild=NULL;
if(X=='.')
pNode=NULL;
A.push(pNode);
cin>>X;
}
B.push(A.front());
A.pop();
root=B.front();
while(!A.empty())
{
BinTreeNode* pfather=B.front();
B.pop();
BinTreeNode* pLchild= A.front();//先出来的是左孩子
A.pop();
BinTreeNode* pRchild= A.front();
A.pop();
pfather->Lchild=pLchild;
pfather->Rchild=pRchild;
//先放入左孩子
if(pLchild!=NULL)