Error in output sequence during traversal of binary tree. No problem in first-order traversal but error in middle-order traversal and second-order traversal.

  c++, question

include<stdio.h>

include<malloc.h>

typedef struct BiTNode{

int data;
 struct BiTNode *lchild,*rchild;

}BiTNode,*BiTree;

void CreateBiTree(BiTNode *&root);
void PreorderShow(BiTNode *root);
void InorderShow(BiTNode *root);
void PostorderShow(BiTNode *root);

int main()
{

BiTree root;
 CreateBiTree(root);
 PreorderShow(root);
 printf("\n");
 InorderShow(root);

// printf(“n”);
/// PostorderShow(root);

return 0;

}

void CreateBiTree(BiTree &root)
{

int ch;
 scanf("%d",&ch);
 if(ch==0)
 root=NULL;
 else
 {
 root=(BiTNode*)malloc(sizeof(BiTNode));
 root->data=ch;
 CreateBiTree(root->lchild);
 CreateBiTree(root->rchild);
 }

}

void PreorderShow(BiTNode *root)
{

if(root)
 {
 printf("%d",root->data);
 PreorderShow(root->lchild);
 PreorderShow(root->rchild);
 }

}

void InorderShow(BiTNode *root)
{

if(root)
 {
 PreorderShow(root->lchild);
 
 printf("%d",root->data);
 
 PreorderShow(root->rchild);
 }

}

void PostorderShow(BiTNode *root)
{

if(root)
 {
 PreorderShow(root->lchild);
 PreorderShow(root->rchild);
 printf("%d",root->data);
 }

}
图片描述

In the middle-order traversal and the later-order traversal, what you call is the first-order traversal function, which is of course wrong. …
In addition, use markdown to paste the code.