这个C++程序是做什么的?我是个初学者,#include //这边程序很不理解;using namespace std;templateclass stack{public:stack();bool isnotempty();private:T sz[num];int point;};template stack::stack(){point=0; }template bool stack::isno

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/12 07:38:11

这个C++程序是做什么的?我是个初学者,#include //这边程序很不理解;using namespace std;templateclass stack{public:stack();bool isnotempty();private:T sz[num];int point;};template stack::stack(){point=0; }template bool stack::isno
这个C++程序是做什么的?我是个初学者,
#include //这边程序很不理解;
using namespace std;
template
class stack
{
public:
stack();
bool isnotempty();
private:
T sz[num];
int point;
};
template stack::stack()
{
point=0;
}
template bool stack::isnotempty()
{
return point!=0;
}
int main()
{
stack st;
cout

这个C++程序是做什么的?我是个初学者,#include //这边程序很不理解;using namespace std;templateclass stack{public:stack();bool isnotempty();private:T sz[num];int point;};template stack::stack(){point=0; }template bool stack::isno
point=0, 是在堆栈的构造器内初始化化堆栈,当然point要清0了,
return point!=0; //这边是什么意思?
要是堆栈为空 则 point!=0 为假
要是堆栈不为空 则 point!=0 为真
作用就是检查堆栈是否为空的