主题:拜托啊,救救小妹啊
#include<stdio.h>
#include<stdlib.h>
#define overflow -2
typedef struct Lnode
{
float data;
struct Lnode *Lchild,*Rchild;
}Lnode,*BiTree;
void enBiTree(BiTree *T)
{
BiTree P;
float ch;
scanf("%f",&ch);
if(ch == 0)
*T = NULL;
else
{
P=(BiTree)malloc(sizeof(Lnode));
if(!T)
exit(overflow);
*T=P;
P->data=ch;
printf("ooooooooo");
enBiTree(&(P->Lchild));
enBiTree(&(P->Rchild));
}
}
void Visit(float *ph)
{
printf("%f",*ph);
}
void FBiTree(BiTree T)
{
if(T)
{
Visit(&(T->data));
FBiTree(T->Lchild);
FBiTree(T->Rchild);
}
}
void MBiTree(BiTree T)
{
if(T)
{
MBiTree(T->Lchild);
Visit(&(T->data));
MBiTree(T->Rchild);
}
}
void LeBiTree(BiTree T)
{
if(T)
{
LeBiTree(T->Lchild);
LeBiTree(T->Rchild);
Visit(&(T->data));
}
}
int main()
{
int n;
BiTree T;
printf("Please Input The float");
T=NULL;
enBiTree(&T);
printf("1:xian xu bian li\n");
printf("2:zhong xu bian li\n");
printf("3:hou xu bian li\n");
scanf("%d",&n);
switch(n)
{
case 1:
FBiTree(T);
break;
case 2:
MBiTree(T);
break;
case 3:
LeBiTree(T);
break;
}
return 0;
}
运行结果啊 ?????
告诉小妹一下啊!!!!!
#include<stdlib.h>
#define overflow -2
typedef struct Lnode
{
float data;
struct Lnode *Lchild,*Rchild;
}Lnode,*BiTree;
void enBiTree(BiTree *T)
{
BiTree P;
float ch;
scanf("%f",&ch);
if(ch == 0)
*T = NULL;
else
{
P=(BiTree)malloc(sizeof(Lnode));
if(!T)
exit(overflow);
*T=P;
P->data=ch;
printf("ooooooooo");
enBiTree(&(P->Lchild));
enBiTree(&(P->Rchild));
}
}
void Visit(float *ph)
{
printf("%f",*ph);
}
void FBiTree(BiTree T)
{
if(T)
{
Visit(&(T->data));
FBiTree(T->Lchild);
FBiTree(T->Rchild);
}
}
void MBiTree(BiTree T)
{
if(T)
{
MBiTree(T->Lchild);
Visit(&(T->data));
MBiTree(T->Rchild);
}
}
void LeBiTree(BiTree T)
{
if(T)
{
LeBiTree(T->Lchild);
LeBiTree(T->Rchild);
Visit(&(T->data));
}
}
int main()
{
int n;
BiTree T;
printf("Please Input The float");
T=NULL;
enBiTree(&T);
printf("1:xian xu bian li\n");
printf("2:zhong xu bian li\n");
printf("3:hou xu bian li\n");
scanf("%d",&n);
switch(n)
{
case 1:
FBiTree(T);
break;
case 2:
MBiTree(T);
break;
case 3:
LeBiTree(T);
break;
}
return 0;
}
运行结果啊 ?????
告诉小妹一下啊!!!!!