#include "stack.h" stack::stack(){ //This is the default constructor //In the absence of user specification, assume //the size arbitrarily size = 50; tos = 0; st = new datatype[size]; } stack::stack(int s){ //Overloaded constructor //Create the stack according to user specification size = s; tos = 0; st = new datatype[size]; } stack::~stack(){ //Deallocate everything that was dynamically allocated delete [] st; } void stack::push(datatype item){ if(tos==size) return; st[tos]=item; tos++; } void stack::pop(datatype &item){ if(tos==0) return; tos--; item=st[tos]; } bool stack::is_empty(){ return (tos==0); }