文章
67
粉丝
207
获赞
29
访问
39.9k
#include <iostream>
using namespace std;
char cc[100][105];
int c=0,d=0;
typedef struct node {
char data;
struct node *l,*r;
}*NodeTree;
void CreatTree(NodeTree &T){
char a=cc[c][d];
d++;
if(a==0)
return;
else if(a=='#'){
T=NULL;
return ;}
else{
T=new node;
T->data=a;
CreatTree(T->l);
CreatTree(T->r);
}
}
void mid(NodeTree T){
if(T==NULL)
return;
mid(T->l);
cout <<T->data <<' ';
mid (T->r);
}
int main(){
while(cin >>cc[c]){
NodeTree T;
CreatTree(T);
mid(T); cout <<endl;
c++;
d=0;
}
system("pause");
return 0;
}
登录后发布评论
暂无评论,来抢沙发