#include "mydefs1.h" #include #include // Array implementation of stacks. // Grow from high index towards 0. void int_stack :: init(int nitems = 100) { sz = nitems; stack = new int[sz]; top = sz; } void int_stack :: push(int x) { assert( !isfull() ); stack[--top] = x; } int int_stack :: pop() { assert( !isempty() ); return( stack[top++] ); } boolean int_stack :: isempty() { return( top == sz ); } boolean int_stack :: isfull() { return( top == 0 ); }