#include typedef enum {false, true} boolean; class int_stack { int sz; int top; int* stack; public: // Note that the stack is implicit void init(int nitems = 100) { sz = nitems; stack = new int[sz]; top = sz; } void push(int x) { assert( !isfull() ); stack[--top] = x; } int pop() { assert( !isempty() ); return( stack[top++] ); } boolean isempty() { return( top == sz ); } boolean isfull() { return( top == 0 ); } };