tal(rootNode->lNode); intrH=leafTotal(rootNode->rNode); returnrH+lH; } }}intmain(){ binTree*rootNode,*tNode; rootNode=NULL; tNode=NULL; charch; cout<<"按照下面给出的顺序进行输入构建二叉树:"<<endl<<"FDBEACJHKGIL"<<endl; cin>>ch; while(ch!='0') { tNode=newbinTree; tNode->data=ch; tNode->lNode=NULL; tNode->rNode=NULL; createT(rootNode,tNode); cin>>ch; } if(rootNode==NULL) { cout<<"TreeisNULL."<<endl; } else { cout<<"正常输出二叉树的各节点数据:"; printT(rootNode); cout<<endl; cout<<"先序遍历二叉树的各节点数据:"; preTraverse(rootNode); cout<<endl; cout<<"中序遍历二叉树的各节点数据:"; midTraverse(rootNode); cout<<endl; cout<<"后序遍历二叉树的各节点数据:"; lastTraverse(rootNode); cout<<endl; cout<<"二叉树的深度为:"<<treeDepth(rootNode)<<endl; cout<<"二叉树的结点的个数为:"<<nodeTotal(rootNode)<<endl; cout<<"二叉树的叶子结点的个数为:"<<leafTotal(rootNode)<<endl; } return0;}