#include<stdio.h>#include<stdlib.h>#include"Stack.h"#include"栈在链接存储下运算的算法.c"/* run this program using the console pauser or add your own getch, system("pause") or input loop */intmain(int argc,char*argv[]){int i,x,y,z;int a[8]={3,8,5,17,9,30,15,22};
Stack r,*S=&r;initStack(S,1);for(i=0;i<8;i++){push(S,a[i]);}
x=pop(S);
y=pop(S);
z=pop(S);printf("%d %d %d\n",x,y,z);push(S,68);
x=peek(S);
y=pop(S);
z=peek(S);printf("%d %d %d\n",x,y,z);push(S,60);while(!emptyStack(S)){printf("%d",pop(S));printf("\n");}clearStack(S);return0;}