
#include <iostream>

#define MAX_STACK 10

// Class
class stack {
private:
  char contents[MAX_STACK];
  int top;
public:
  void init(void );
  void push(char c);
  char pop(void );
};

void stack::init(void)
{
  top=0;
}

void stack::push(char c)
{
  contents[top]=c;
  top++;
}

char stack::pop(void)
{
  top--;
  return(contents[top]);
}

int main(void )
{
  stack s1;

  s1.init();

  s1.push('C');
  s1.push('S');
  s1.push('3');
  s1.push('1');
  s1.push('9');

  std::cout << "Popping ... " << std::endl;

  std::cout << s1.pop() << std::endl;
  std::cout << s1.pop() << std::endl;
  std::cout << s1.pop() << std::endl;
  std::cout << s1.pop() << std::endl;
  std::cout << s1.pop() << std::endl;

  return (0);
}

