#include<stdio.h>
#include"head.h"
#include"stack.h"
/*
status initStack(sqStack *S);
status destroyStack(sqStack *S);
status clearStack(sqStack *S);
int length(sqStack S);
boolean empty(sqStack S);
boolean push(sqStack *S,ElementType e);
boolean pop(sqStack *S,ElementType *e);
status getTop(sqStack S,ElementType *e);
void traverse(sqStack S,void (*view)(ElementType*));
*/
int main()
{
ElementType a[MAX],e,e1;
int i;
sqStack S;
buildSet(a,MAX,0,100);
printf("show the random array\n");
printSet(a,MAX);
if(initStack(&S))
printf("the address of the stack is :%d\n",S);
if(empty(S))
printf("the stack is empty\n");
for(i=0;i<MAX;i++)
push(&S,a[i]);
printf("traverse the stack after push elements\n");
traverse(S,view);
printf("the length of the stack is :%d\n",length(S));
getTop(S,&e);
printf("the element of the top is :%d\n",e);
pop(&S,&e);
getTop(S,&e1);
printf("the pop elements is %d ,and the new top is %d\n",e,e1);
if(clearStack(&S))
printf("after clear the stack the length of the stack is :%d\n",length(S));
if(destroyStack(&S))
printf("after destroy the stack the address is :%d\n",S.base);
}