#include "iStack.h" #include "stackExcp.h" #include using namespace::std; enum ErrorCodes { errorCodePush = 1, errorCodePop }; void iStack::pop(int &top_value){ if(empty()) throw popOnEmpty(errorCodePop); top_value = _stack[--_top]; cout << "iStack::pop(): " << top_value << endl; } void iStack::push(int value){ if(full()) throw pushOnFull(errorCodePush); _stack[_top++] = value; cout << "iStack::push(): " << value << endl; } bool iStack::full(){ return _top >= _capacity; } bool iStack::empty(){ return _top == 0; } void iStack::display(){ cout << "stack members:"; for(int i = 0; i < _top; ++i) cout << ' ' << _stack[i]; cout << endl; } int iStack::size(){ return _top; }