#include<bits/stdc++.h>
#define MAXSIZE 100
using namespace std;
typedef int datatype;
typedef struct{
datatype a[MAXSIZE];
int top;
}sequence_stack;
int main() {
return 0;
}
void init(sequence_stack *slt){ //栈的初始化
slt->top=0;
}
int empty(sequece_stack *slt){//判断栈是否为空
return (slt->top?0:1);
}
int read(sequece_stack *slt){ //输出栈顶的值
if(empty(slt)){
printf("该栈为空的!");
exit(1);
}
else{
return slt->a[slt->top];
}
}
void push(sequece_stack *slt,datatype x){ //栈的插入操作
if(st->top==MAXSIZE-1){
printf("该栈满了!");
exit(1);
}
slt->top++;
slt->a[slt->top]=x;
}
void del(sequece_stack *slt){ //栈的删除操作
if(empty(slt)){
printf("该栈为空的!");
exit(1);
}
else{
slt->top--;
}
}
1.栈的初始化
2.判断栈是否为空
3.输出栈顶的值
4.栈的插入操作
5.栈的删除操作