📄 astack.h
字号:
#ifndef ASTACK_H_H
#define ASTACK_H_H
template<class Elem>class AStack{
public:
int size;
int top;
Elem* listArray;
public:
AStack(int sz=DefaultListSize)
{size=sz;top=0;listArray=new Elem[sz];}
~AStack(){delete [] listArray;}
void clear(){top=0;}
bool push(const Elem& item){
if(top==size) return false;
else{listArray[top++]=item;return true;}
}
bool pop(Elem& item){
if(top==0) return false;
else{item=listArray[--top];return true;}
}
bool topValue(Elem& it)const{
if(top==0) return false;
else{it=listArray[top-1];return true;}
}
int length()const{return top;}
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -