// Show static implementation of a class
#include // for srandom(), random()
using std::srandom;
using std::random;
#include // for time()
using std::time;
#include
using std::cout;
class Stack {
private:
enum { MAX_STACK = 10 };
static int stack[MAX_STACK];
static int top;
public:
static void push(int item) { stack[top++] = item; }
static int pop() { return stack[--top]; }
static int is_empty() { return top == 0; }
static int is_full() { return top >= MAX_STACK; }
};
int Stack::stack[MAX_STACK];
int Stack::top = 0;
int main () {
int i = 1;
for (srandom (time (0L)); !Stack::is_full(); Stack::push(random ()));
while (!Stack::is_empty ()) cout << i++ << " : " << Stack::pop () << "\n";
}