📄 lxastack.cpp
字号:
// lxastack.cpp: implementation of the lxastack class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "lxastack.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
lxastack::lxastack(int sz=defaultlistsize)
{
size=sz;
top=0;
listarray=new int[sz];
}
lxastack::~lxastack()
{
delete [] listarray;
}
void lxastack::clear()
{
top=0;
}
bool lxastack::push(const int &item)
{
if(top==size) return false;
else {listarray[top++]=item;return true;}
}
bool lxastack::pop(int &it)
{
if(top==0) return false;
else {it=listarray[--top];return true;}
}
bool lxastack::topvalue(int &it)
{
if(top==0)return false;
else{it=listarray[top-1];return true;}
}
int lxastack::length() const
{
return top;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -