#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#define MAX 100
typedef struct book{
char isbn[20];
char name[10];
double price;
}Book;
typedef struct{
Book *top;
Book *base;
int stacksize;
}Sqstack;
int main(void)
{
return 0;
}
bool Init_stack(Sqstack *S)
{
S->base = (Book*)malloc(sizeof(Book) * MAX);
if(!S->base)
{
return false;
}
S->top = S->base;
return false;
}
bool Stack_empty(Sqstack S)
{
if(S.top == S.base)
{
return false;
}else{
return true;
}
}
bool Destroy_stack(Sqstack *S)
{
if(S->base)
{
free(S->base);
S->base = NULL;
S->top = NULL;
}
return true;
}
bool press_stack(Sqstack *S,Book e)
{
if(S->top - S->base == S->stacksize)
{
return false;
}else{
*S->top ++ = e;
return true;
}
}
bool deliver_stack(Sqstack *S,Book *e)
{
if(S->top == S->base)
{
return false;
}
*e = *--S->top;
return true;
}