?? 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 + -