home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_08_07
/
8n07071a
< prev
next >
Wrap
Text File
|
1990-06-19
|
574b
|
30 lines
typedef int Boolean;
const Boolean TRUTH = 1;
const Boolean FALSE = 0;
const int dim = 10;
class Stack {
public:
// initialize stack to sane state
Stack() { index = 0; }
// push a int value
void push(int x) { data[index++] = x; }
// remove top value and return it
int pop() { return data[--index]; }
// returns true if empty
Boolean isempty() { return index == 0;
// returns true if full
Boolean isfull() { return index >= dim; }
private:
int index;
int data[dim];
};