#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)
|