#include <iostream.h>

const size=100;

class Stack
{
	private:
		int S[size];
		int Top;
	public:
		Stack();
		void Push(int);
		void Pop();
		bool isEmpty();
		bool isFull();
		void Print();		

}; //end of class

Stack::Stack()
{ Top=-1;}

void Stack::Push(int newData)
{
	if(!isFull() )
	{
		Top++;
		S[Top]= newData;
	}
	 else
		 cout<<"STACK is full"<<endl;
}

void Stack::Pop ()
{
	 if(!isEmpty() )
	 {
		int x=S[Top];
		    Top++;
			cout<<x<<endl;
	 }
	 else
		 cout<<"STACK is empty"<<endl;
}

bool Stack:: isEmpty()
 {
	 if(Top ==-1 )

		return true;
	else
		return false;
  }
bool Stack:: isFull ()
{
	 {
	 if(Top==size-1 )

		return true;
	else
		return false;
	 }
}

void Stack:: Print()
{
	for(int i=Top; i<=size-1; i++)

		   cout<<S[i]<<endl;
}

//Main Program

void main()
 {
	  Stack T;
	int Choise, x;

	do
	{
		cout<<" 1 : Push"<<endl;
		cout<<" 2 : Pop "<<endl;
		cout<<" 3 : isEmpty  "<<endl;
		cout<<" 4 : isFull "<<endl;
		cout<<" 5 : Print "<<endl;
		cout<<" 0 : Stop "<<endl;

	   cout<<" Enter your choise?  "<<endl;
	   cin>> Choise;

	    switch(Choise)
		{
	          case 1:
		         cout<<"Enter an element? ";
				 cout<<endl<<endl; 
		         cin>>x;
				T.Push(x);//Call
				
		         break;

	       	 case 2:
		         T.Pop();  //Call
		         T.Print();  //Optional Call to print all the stack list

		          break;

	    	 case 3:
		         T.isEmpty();  //Call
				 T.Print();

	        	   break;

		      case 4:
		           T.isFull();  //Call
				   T.Print();

		            break;

	       	 case 5:

		           T.Print();

		       break;

		     case 0:

		          cout<<"The Program is terminated "<<endl;

		       break;
     
            default:

		   cout<<"Bad Choise"<<endl;
		}
	}

	   while(Choise !=0);
}//end of main
