#include#include #include #define MAXSIZE 100 typedef struct BiTNode { char data; struct BiTNode *lchild,*rchild; }BiTNode,*BiTree; CreateTree(BiTree &T) { char c; scanf("%c",&c); if(c=='#') T=NULL; else { T=new BiTNode; T->data=c; CreateTree(T->lchild); CreateTree(T->rchild); } } void zhongbian(BiTree T) { if(T) { zhongbian(T->lchild); printf("%c",T->data); zhongbian(T->rchild); } } int main() { BiTree T; CreateTree(T); zhongbian(T); return 0; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)