程序运行不了,求解

[复制链接]
查看11 | 回复1 | 2011-1-2 22:18:10 | 显示全部楼层 |阅读模式
#include
typedef int ElemType
typedef struct tnode
{
ElemType data;
struct tnode *lchild,*rchild;
}BTNode;
void main()
//二叉树应用
{
BTNode *b;
ElemType path[MaxSize];
CreateBTree(b,"A(B(D,E(G,H)),C(,F(I)))");
cout lchild==NULL && b->rchild==NUll)
//*b为叶子结点
{
cout data data;
for(i=pathlen-1;i>=0;i--)

cout data;
//将当前结点放入路径中
pathlen++;
//路径长度曾1
AllPath(b->lchild,path,pathlen); //递归扫描左子树
AllPath(b->rchild,path,pathlen); //递归扫描右子树
pathlen--;
//恢复环境
}
}
}
App.cpp
F:\c\二叉树\App\App.cpp(4) : error C2143: syntax error : missing ';' before ''
F:\c\二叉树\App\App.cpp(4) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
App.exe - 1 error(s), 0 warning(s)

回复

使用道具 举报

千问 | 2011-1-2 22:18:10 | 显示全部楼层
#includetypedef int ElemType;//少了一个冒号#define MaxSize 30
//没有宏定义 MaxSizetypedef struct tnode{ ElemType data; struct tnode *lchild,*rchild;}BTNode;void AllPath(BTNode *b,ElemType path[],int pathlen);//声明函数void main()
//二叉树应用{ BTNode *b=new BTNode;//初始化指针b ElemType path[
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行