#include<iostream>
using namespace std;

class Stack {
  private:
    int st[3]; 
    int top;           
  public:
    class Full{
        public:   
          Full(){
            cout<<"Full Constructor"<<endl;
          } 
    };
    class Empty { 
          public: 
            Empty(){
              cout<<"Empty constructor"<<endl;
            } 
    };
    Stack() { 
      top = -1; 
    }
    void push(int var) {
      if(top >= 3-1)
        throw Full();   
      st[++top] = var;  
    }
    int pop() {
      if(top < 0)
        throw Empty(); 
      return st[top--]; 
    }
};

main()  {
    Stack s1;
    try {
    s1.push(11); s1.push(22);
    s1.push(33); s1.push(44);
    cout<<"Hello world"<<endl; 
    cout << "1: " << s1.pop() << endl;
    cout << "2: " << s1.pop() << endl;
    cout << "3: " << s1.pop() << endl;
    cout << "4: " << s1.pop() << endl; 
    }
    catch(Stack::Full){
      cout << "Exception: Stack is Full"<<endl;
    }
    catch(Stack::Empty){
      cout<< "Exception : stack is empty"<<endl;                     
    }
    cout << "Arrive here"<<endl;
    system("pause");
}
