这个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/07/06 03:51:36
![这个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](/uploads/image/z/9821768-32-8.jpg?t=%E8%BF%99%E4%B8%AAC%2B%2B%E7%A8%8B%E5%BA%8F%E6%98%AF%E5%81%9A%E4%BB%80%E4%B9%88%E7%9A%84%3F%E6%88%91%E6%98%AF%E4%B8%AA%E5%88%9D%E5%AD%A6%E8%80%85%2C%23include+%2F%2F%E8%BF%99%E8%BE%B9%E7%A8%8B%E5%BA%8F%E5%BE%88%E4%B8%8D%E7%90%86%E8%A7%A3%EF%BC%9Busing+namespace+std%3Btemplateclass+stack%7Bpublic%3Astack%28%29%3Bbool+isnotempty%28%29%3Bprivate%3AT+sz%5Bnum%5D%3Bint+point%3B%7D%3Btemplate+stack%3A%3Astack%28%29%7Bpoint%3D0%3B+%7Dtemplate+bool+stack%3A%3Aisno)
这个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 为真
作用就是检查堆栈是否为空的