📄 astack.h
字号:
#ifndef ASTACK1_H
#define ASTACK1_H
#include<iostream.h>
class AStack{
public:
int size;
int top;
char *listArray;
public:
AStack(int sz)
{ size=sz; top=0; listArray=new char[sz]; }
~AStack() {delete [] listArray; }
void clear() {top=0; }
bool isEmpty()
{
if(top==0) return true;
else
return false;
}
bool push(char &item)
{
if(top==size) return false;
else { listArray[top++]=item; return true; }
}
bool pop()
{
if(top==0) return false;
else { --top;return true; }
}
bool topValue(char& it)
{
if(top==0) return false;
else { it=listArray[top-1];return true; }
}
void print()
{
if(top==0) cout<<"the stack is empty.\n";
else
for(int i=0;i<top;i++)
cout<<listArray[i];
cout<<endl;
}
int length(){return top;}
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -