C语言的 999999命

来源:百度知道 编辑:UC知道 时间:2024/06/03 07:02:55
#include<stdio.h>
#include<stdlib.h>
typedef struct node
{
int data;
struct node *lchild,*rchlid;
}bintnode;
typedef bintnode *bintree;
bintree createbintree(bintree t);
void preorder(bintree t);
void inorder(bintree t);
void postorder(bintree t);
void main()
{ bintree t;
char ch1,ch2;
printf("\n xunzheba:\n") ;
ch1='y';
while(ch1=='y'||ch1=='Y')
{
printf("\nA");
printf("\nB");
printf("\nC");
printf("\nD");
printf("\nE");
scanf("\n%c",&ch2);
switch(ch2)
{
case 'a':
case 'A':
printf("xianxujianli:");
t=createbintree(t);
break;
case 'b':
case 'B':
printf("xianxubianli:");
preorder(t);
break;
case 'c':

1、e和E那里的case错写成了caes
2、null应该写NULL(大写才行)
3、struct node *lchild,*rchild;后边全用的是rchild,你定义的是rchlid

#include<stdlib.h>
typedef struct node
{
int data;
struct node *lchild,*rchild;
}bintnode;
typedef bintnode *bintree;
bintree createbintree(bintree t);
void preorder(bintree t);
void inorder(bintree t);
void postorder(bintree t);
void main()
{ bintree t;
char ch1,ch2;
printf("\n xunzheba:\n") ;
ch1='y';
while(ch1=='y'||ch1=='Y')
{
printf("\nA");
printf("\nB");
printf("\nC");
printf("\nD");
printf("\nE");
scanf("\n%c",&ch2);
switch(ch2)
{
case 'a':
case 'A':
printf("xianxujianli:");
t=createbintree(t);
break;
case 'b':
ca