home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_09 / 8n09119a < prev    next >
Text File  |  1990-07-09  |  759b  |  19 lines

  1.  
  2.         typedef int Truth;
  3.         const int TRUE = 1;
  4.         const int FALSE = 0;
  5.         const int size = 100;   // constant integer, kind of like a macro
  6.  
  7.         class Stack {        // Stack of integers
  8.         public:                 // these members are public
  9.                 Stack()                 { sp = 0; }
  10.                 void push( int x)       { elt[sp++] = x; }
  11.                 int pop()               { return elt[--sp]; }
  12.                 Truth isempty()         { return sp <= 0; }
  13.                 Truth isfull()          { return sp >= size; }
  14.         private:                // these (data) members are private
  15.                 int sp;         // sp 'points' to next available slot
  16.                 int elt[size];
  17.         };
  18.  
  19.