#include "mydefs2.h" #include // 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 = 100) { top = 0; } 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; } boolean int_stack :: isempty() { return( top == 0 ); } boolean int_stack :: isfull() { return( 0 ); }