#include
using namespace std;
struct Binode{
char data;
Binode *lchild,*rchild;
};
class Bitree{
public:
Bitree(){root=Creat(root);}
void Leverorder();
private:
Binode *root;
Binode *Creat(Binode *bt);
};
Binode *Bitree::Creat(Binode *bt){
char ch;
cin>>ch;
if(ch=='#')bt=NULL;
else{
bt=new Binode();bt->data=ch;
bt->lchild=Creat(bt->lchild);
bt->rchild=Creat(bt->rchild);
}
return bt;
}
void Bitree::Leverorder(){
Binode *Q[100];Q[100]=new Binode();
int front=-1,rear=-1;
if(root==NULL)return;
else{
rear++;Q[rear]=root;
while(front!=rear){
Binode *q;q=new Binode();
front++;q=Q[front];
cout<data;
if(q->lchild!=NULL)Q[++rear]=q->lchlid;
if(q->rchild!=NULL)Q[++rear]=q->rchlid;
}
}
}
int main()
{
Bitree m;
m.Leverorder();
return 0;
}
编译一下是有错误的但我不知道怎么改正
[Error] C:\Users\35321\Documents\C-Free\Temp\未命名1.cpp:36: error: 'struct Binode' has no member named 'lchlid'
[Error] C:\Users\35321\Documents\C-Free\Temp\未命名1.cpp:37: error: 'struct Binode' has no member named 'rchlid'
求指教QAQ