| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 437 人关注过本帖
标题:【C++ 】 编译不通 求改错!
只看楼主 加入收藏
my19891115
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2010-6-15
结帖率:50%
收藏
已结贴  问题点数:10 回复次数:1 
【C++ 】 编译不通 求改错!
const int maxstack=30;
int count;


enum Error_code{overflow,success,underflow};
enum Error_code outcome;

template<class T,int maxstack> class Stack
{
public:
    Stack();                                     //constructor
    bool empty() const;
    bool full() const;
    Error_code pop();                           
    Error_code top(T &item) const;
    Error_code push(const T &item);
private:
    int count;
    T entry[maxstack];
    T item;
};





//以下为Stack类定义

template<class T,int maxstack> void class Stack<T,maxstack>::Stack()                                      //constructor
{count=0;}

template<class T,int maxstack> bool class Stack<T,maxstack>::empty() const
{
 bool outcome=true;
 if(count>0)outcome=false;
 return outcome;
}


template<class T,int maxstack> bool class Stack<T,maxstack>::full() const
{
 bool outcome=false;
 if(count=maxstack-1) outcome=true;
 return outcome;
}


template<class T,int maxstack> Error_code class Stack<T,maxstack>::pop()                          
{
 Error_code outcome=success;
 if(count=0)
    outcome=underflow;
 else --count;
 return outcome;
}



template<class T,int maxstack> Error_code class Stack<T,maxstack>::top(T &item)const             //取操作数栈顶元素item
{
 Error_code outcome=success;
 if(count=0)
    outcome=underflow;
 else item=entry[count-1];
 return outcome;
}



template<class T,int maxstack> Error_code class Stack<T,maxstack>::push(const T &item)      //将数据item压入操作数栈中
{
 Error_code outcome=success;
 if(count>=maxtrack)
    outcome=overflow;
 else entry[count++]=item;
 return outcome;
}


请问这个有什么错误?
怎么改。。。
搜索更多相关主题的帖子: 改错 编译 
2010-06-19 21:03
chen3bing
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:507
专家分:104
注 册:2008-11-12
收藏
得分:10 
你不是说编译不通吗?提示什么错误啊?让别人替你编译码?
2010-06-20 18:46
快速回复:【C++ 】 编译不通 求改错!
数据加载中...
 
   



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

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