#include<iostream.h>

void push(int mystack[], int &mytop, int item){

      mystack[mytop]=item;

      mytop=mytop+1;}//PUSH

int pop(int mystack[], int &mytop){

      mytop=mytop-1;

      int item=mystack[mytop];

      return item;}//POP

int isempty(int mytop){

      if(mytop==0) return 1;

      else return 0;}//ISEMPTY

int isfull(int mytop, const int MAXSTACKSIZE){

      if(mytop==MAXSTACKSIZE) return 1;

      else return 0;}//ISFULL

void main(){

      const int MAXSTACKSIZE=5;

      int mystack[MAXSTACKSIZE]; int mytop, x, option;

      mytop=0; //STACK TOP INITILIZATION

      do{ cout<<"SELECT ONE OF THE FOLLOWING OPTIONS: "<<endl;

      cout<<"1-PUSH 2-POP 3-ISEMPTY 4-ISFULL 5-QUIT: ";

      cin>>option;

      switch(option){

            case 1: if(isfull(mytop,MAXSTACKSIZE))

                              cout<<"YOU CAN'T PUSH"<<endl;

                        else{ cout<<"ENTER THE NUMBER THAT WILL BE PUSHED: ";

                              cin>>x;

                              push(mystack, mytop, x);}//ELSE

                              break;

            case 2: if(isempty(mytop))

                              cout<<"YOU CAN'T POP"<<endl;

                        else{ cout<<"THE NUMBER POPPED IS: "<<pop(mystack, mytop);

                        cout<<endl;}//ELSE

                        break;

            case 3: if(isempty(mytop)==1)

                              cout<<"STACK EMPTY."<<endl;

                        else cout<<"STACK IS NOT EMPTY."<<endl;

                        break;

            case 4: if (isfull(mytop, MAXSTACKSIZE)==1)

                              cout<<"STACK FULL."<<endl;

                        else cout<<"STACK IS NOT FULL."<<endl;

                        break;

            case 5: cout<<"THANK YOU FOR USING OUR MENU!"<<endl;

                  break;

            default: cout<<"ENTER CORRECT OPTIONS"<<endl;}//SWITCH

      }while(option !=5);

}//MAIN

1