内容发布更新时间 : 2024/12/23 20:46:10星期一 下面是文章的全部内容请认真阅读。
typedef char stack; struct node {
stack a[size]; int top; };
int Isempty(struct node *s) {
return (s->top==-1?True:False); }
int Isfull(struct node *s) {
return (s->top+1==size?True:False); }
int Push(struct node *s,stack x) {
if(!Isfull(s)) { s->top++; s->a[s->top]=x;
return True; } else return False; }
int Pop(struct node *s, stack *x) { if(!Isempty(s)) {
*x=s->a[s->top]; s->top--;
return True; } else return False; }
int Gettop(struct node *s) { stack x; if(!Isempty(s)) {
x=s->a[s->top];
return x; } else return False; } //整形 栈 typedef int sta;
struct node1 { sta a[size]; int top; };
int Isempty1(struct node1 *s) {
return (s->top==-1?True:False); }
int Isfull1(struct node1 *s)
{
return (s->top+1==size?True:False); }
int Push1(struct node1 *s,sta x) {
if(!Isfull1(s)) { s->top++;
s->a[s->top]=x;
return True; } else return False; }
int Pop1(struct node1 *s, sta *x) {
if(!Isempty1(s)) {