構文エラーは、(例えばセミコロン、など- >、など)いくつかの小さなコンパイル時間がかかるかもしれない、ああ、自分自身を修正するのは簡単です絶対に考えて完全に正確であるので、それを変更するために変更しようとするために、あなた自身の言葉を使用し、コピーして貼り付け正しい、それはあまりにもコードの経験を書いていないし、彼はそれを変更するには、より印象的な変化であった(^▽^)~~~~。
#include<iostream>
using namespace std;
typedef struct BiNode{
char data;
struct BiNode *lchild,*rchild;
}BiTNode,*BiTree;
void CreateBiTree(BiTree &T){
char ch;
cin>>ch;
if(ch=='#') T=NULL;
else{
T=new BiTNode;
T->data=ch;
CreateBiTree(T->lchild);
CreateBiTree(T->rchild);
}
}
int NodeCount(BiTree T){
if(T==NULL) return 0;
else return NodeCount(T->lchild)+NodeCount(T->rchild)+1;
}
void main(){
BiTree tree;
cout<<"请输入建立二叉链表的序列:\n";
CreateBiTree(tree);
cout<<"结点个数为:"<<NodeCount(tree)<<endl;
}