li584528142 2016-10-14 10:33 采纳率: 33.3%
浏览 798

在二叉树编程中,出现缺少“;”的问题

#include
using namespace std;
template
class BinaryTree;//出现error C2143: syntax error : missing ';' before '<'
template
class BinaryTreeNode
{
friend class BinaryTree;
private:
T element;
BinaryTreeNodeleft,*right;
public:
BinaryTreeNode(); //缺省构造函数
BinaryTreeNode(const T& ele);//给定数据构造函数
BinaryTreeNode(const T& ele, BinaryTreeNode
l, BinaryTreeNode* r);
T value() const;//返回当前结点的数据
//返回当前结点指向左子树
BinaryTreeNode* leftchild() const;
//返回当前结点指向右子树
BinaryTreeNode* rightchild() const;

//设置当前结点的左子树
void setLeftchild(BinaryTreeNode) ;
//设置当前结点的右子树
void setRightchild(BinaryTreeNode
) ;
//设置当前结点的数据域
void setValue(const T& val);
bool isLeaf() const; //重载赋值操作符
BinaryTreeNode& operator= (const BinaryTreeNode& Node)
{
this=Node;
};
};
template
class BinaryTree
{
private:
//二叉树根结点指针
BinaryTreeNode* root;
//从二叉树的root结点开始查找current结点的父结点
BinaryTreeNode GetParent (BinaryTreeNode* root, BinaryTreeNode* current);

public:

BinaryTree(){root=NULL}; //构造函数
~BinaryTree() {DeleteBinaryTree(root);};//析构函数
//前序周游二叉树或其子树
void PreOrder(BinaryTreeNode* root);
//中序周游二叉树或其子树
void InOrder(BinaryTreeNode* root);
//后序周游二叉树或其子树
void PostOrder(BinaryTreeNode* root);
//按层次周游二叉树或其子树
void BLevelOrder (BinaryTreeNode *root);
void CreateTree (BinaryTreeNode *t) ;
};

  • 写回答

1条回答 默认 最新

  • threenewbee 2016-10-14 12:27
    关注

    void CreateTree (BinaryTreeNode *t) ;
    这一行的分号是全角的。

    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?