#include "mydefs2.h" // Linked list implementation of stacks. int_stack :: node* int_stack :: new_node(int d, node* n) { node* t = new node; assert( t ); t -> data = d; t -> next = n; return( t ); } void int_stack :: init(int nitems) { top = NULL; cout << "Initialize with " << nitems << endl; } void int_stack :: push(int x) { top = new_node(x, top); } int int_stack :: pop() { assert( !isempty() ); int t = top -> data; node* oldtop = top; top = top -> next; delete oldtop; return t; } bool int_stack :: isempty() { return( top == NULL ); } bool int_stack :: isfull() { return( false ); }