#include using namespace std; // intstack.h #ifndef intstack_h // this avoids multiple inclusion of this file into the #define intstack_h // same file, i.e. another file doing 2 includes of this // file. (always do this for header files) // this is closed by the #endif at the end // this is the class definition for intstack // this creates a stack implemented as an integer array class intstack { private: // private variables/functions can't be changed/looked at by users // private member variables int thetop; // top of the stack int *a; // array od elements (the stack) int max; // maximum number of elements public: // public variables/functions can be changed/looked at by users) intstack(); // constructor of class (called when object is created) intstack(int); // another contructor // declarations of public "member functions" or "methods" void push (int); // pushes integer into stack int pop(); // pops integer from stack int size(); // returns the total size of stack int top(); // returns thetop or the total size used by stack int looktop(); // returns (without removing) the top element void print(ostream &); // prints its content to an ostream (that can be cout) }; #endif