// intstack.cpp #include "intstack.h" // this module has now access to the class definition // implementations of the the member functions (methods) // node that all of them must have the class name before their name "intstack::" intstack::intstack() { // constructor member function thetop=0; // initializes top to zero max=0; } intstack::intstack(int maxsize) { // constructor member function thetop=0; // initializes top to zero max = maxsize; a = new int[maxsize]; // allocates maxsize positions for the array s } void intstack::push (int i) { if (thetop < max) { a[thetop]=i; thetop++; } else cout<< "\n>>>> Push unsucessfull:" << " tried to push, exceeding size = "<>>> Pop unsucessfull: tried to pop from empty stack\n\n"; return -1; } else { thetop--; return a[thetop]; } } int intstack::size() { return max; } int intstack::top() { return thetop; } int intstack::looktop() { return a[thetop-1]; } void intstack::print(ostream & output) { if (thetop == 0) output << "The Stack is empty"; else { output << "The stack = "; for (int i=0;i