#include #include class Stack { #define MAX 10 int stackdata[MAX]; int top; public: Stack() { top=-1; } int Push(int what) { if (top-1) { r=stackdata[top]; stackdata[top]=0; top--; return r; } return -1; } bool isempty() { if (top==-1) return true; return false; } bool isfull() { if (top==MAX-1) return true; else return false; } int gettop() { return stackdata[top]; } }; void main() { Stack s1,s2; s1.Push(33); s1.Push(23); s1.Push(13); s2.Push(5); s2.Push(6); printf("s1 pop = %d\n",s1.Pop()); printf("s1 pop = %d\n",s1.Pop()); printf("s2 pop = %d\n",s2.Pop()); }