Establish binary linked list in first order and traverse in first order, middle order and then order (recursion)

Time:2022-1-6
#include<iostream>
using namespace std;
typedef struct BiNode{
    char data;
    struct BiNode *lchild,*rchild;
}BiTNode,*BiTree;
//Establish binary linked list first
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);
    }
}
//Preorder traversal 
void Pre(BiTree T){  
    if(T){
        cout<<T->data;
        Pre(T->lchild);
        Pre(T->rchild);
    }
}
//Medium order traversal 
void In(BiTree T){  
    if(T){
        In(T->lchild);
        cout<<T->data;
        In(T->rchild);
    }
}
//Postorder traversal 
void Post(BiTree T){  
    if(T){
        Post(T->lchild);
        Post(T->rchild);
        cout<<T->data;
    }
}
int main(){
    BiTree tree;
    Cout < < "create binary linked list first:";
    CreateBiTree(tree);
    Cout < < "the result of preorder traversal is:"; 
    Pre(tree);
    cout<<endl;
    Cout < < "the result of middle order traversal is:";
    In(tree);
    cout<<endl;
    Cout < < "the result of post order traversal is:";
    Post(tree);
    cout<<endl;
}

Establish binary linked list in first order and traverse in first order, middle order and then order (recursion)