📄 test.cpp
字号:
#include <iostream.h>
class stack
{
public:
stack();
bool push(int);
bool pop();
private:
int base;
int top;
int Array[4];
}
stack::stack()
{
base = 0;
top = 0;
}
bool stack::push(int x)
{
if(top == 3)
{
cout<<"堆栈已满,因此不能入栈"<<endl;
return false;
}
else
{
Array[top] = x;
top++;
return true;
}
}
bool stack::pop()
{
if(top == 0 )
{
cout<<""<<endl;
return false;
}
else
{
top--;
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -