#include #include template class Stack { #define MAX 25 TYPE stackdata[MAX]; int top; public: Stack() { top=-1; } int Push(TYPE what) { if (top-1) { r=stackdata[top]; top--; return r; } return r; } bool isempty() { if (top==-1) return true; return false; } bool isfull() { if (top==MAX-1) return true; else return false; } }; void main() { Stack istack; istack.Push(20); istack.Push(30); istack.Push(40); printf("Integer Stack pop = %d\n",istack.Pop()); Stack dstack; dstack.Push(3.14); dstack.Push(4.88); dstack.Push(5.89); dstack.Push(43.2234); printf("Double Stack pop = %f\n",dstack.Pop()); printf("Double Stack pop = %f\n",dstack.Pop()); Stack cstack; cstack.Push('A'); cstack.Push('B'); cstack.Push('Z'); cstack.Push('P'); printf("Char Stack pop = %c\n",cstack.Pop()); printf("Char Stack pop = %c\n",cstack.Pop()); }