标题:[求助]各位帮一下忙啊
只看楼主
fateboy
Rank: 1
等 级:新手上路
帖 子:35
专家分:0
注 册:2006-5-21
 问题点数:0 回复次数:0 
[求助]各位帮一下忙啊

各位大哥大姐门帮忙查以下错啊:
头文件:
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
typedef char TElemType;
typedef int status;
typedef struct BiTNode
{
TElemType data;
struct BiTNode * lchild,* rchild;
}BiTNode,*BiTree;
status CreateBiTree(BiTree &T);
status PreOrderTraverse(BiTree T,status(*visit)(TElemType e));
status InOrderTraverse(BitTree T,status (*visit)(TElemType e));


#include<iostream.h>
#include "la2.h"
#include<stdlib.h>
status CreateBiTree(BiTree &T)
{ char ch;
cin>>ch;
if(ch=='$')
T=NULL;
else
{
if(!(T=(BiTNode *)malloc(sizeof(BiTNode))))
exit(OVERFLOW);
T->data=ch;
CreateBiTree(T->lchild);
CreateBiTree(T->rchild);
}
return OK;
}


status PrintElement(TElemType e)
{ cout<<e<<"\t";
return OK;
}
status PreOrderTraverse(BiTree T,status (* visit)(TElemType e))
{ if(T){
if(visit(T->data))
if(PreOrderTraverse(T->lchild,visit))
if(PreOrderTraverse(T->rchild,visit))
return OK;
return ERROR;
}
return OK;
}//PreOrderTraverse;
status InOrderTraverse(BitTree T,status (* visit)(TElemType e))
{
if(T){
if(InOrderTraverse(T->lchild,visit))
if(visit(T->data))
if(InOrderTraverse(T->rchild,visit))
return OK;
return ERROR;
}return OK;

}
void main()
{ BiTree T1;
cout<<"请输入二叉树先序遍历"<<endl;

CreateBiTree(T1);
cout<<"please output"<<endl;

PreOrderTraverse(T1,PrintElement);
cout<<endl;
cout<<"please output"<<endl;

InOrderTraverse(T1,PrintElement);
cout<<endl;
}
f:\visual c++\8\la2.h(16) : error C2065: 'BitTree' : undeclared identifier
f:\visual c++\8\la2.h(16) : error C2146: syntax error : missing ')' before identifier 'T'
f:\visual c++\8\la2.h(16) : error C2059: syntax error : ')'
f:\visual c++\8\la1.cpp(35) : error C2146: syntax error : missing ')' before identifier 'T'
f:\visual c++\8\la1.cpp(35) : error C2086: 'InOrderTraverse' : redefinition
f:\visual c++\8\la1.cpp(35) : error C2059: syntax error : ')'
f:\visual c++\8\la1.cpp(36) : error C2143: syntax error : missing ';' before '{'
f:\visual c++\8\la1.cpp(36) : error C2447: missing function header (old-style formal list?)
f:\visual c++\8\la1.cpp(57) : error C2064: term does not evaluate to a function
执行 cl.exe 时出错.

搜索更多相关主题的帖子: status visit 大哥 
2006-05-22 22:44



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-66359-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.009913 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved