📄 stack.cpp
字号:
// stack.cpp: implementation of the stack class.
//
//////////////////////////////////////////////////////////////////////
#include "stack.h"
#include "iostream.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
void stack::Push(int x)
{
if (top==MaxSize-1) cout<<"overflow"; //栈满处理
else {
top++;
Vec[top]=x; //填入新元素
}
}
int stack::GetTop()
{
if (top==-1) cout<<"数制转换成功"; //栈空处理
else return Vec [top]; //返回栈顶元素
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -