#include<stdio.h>
#include<string.h>
#define STACKSIZE 5
void PUSH (struct stack *ps,int x);
int empty (struct stack *ps);
int POP (struct stack *ps);
int manue (int ch);
void Display(struct stack *ps);
int ch,x,m;
struct stack 
{
	int top;
	int items[STACKSIZE];
};



main()
{
	struct stack s;
		printf("\n\t\t Stack Lab ");
		printf("\n\t\tmeesa farhan\n\n");
	do
	{
		ch=manue(ch);
		switch(ch)
			{
		case 1:
			{
				printf("Enter num: ");
				scanf("%d",&m);
				PUSH(&s,x);
			}
			break;
		case 2:
			{
				int x;
				x=POP(&s);
			}
			break;
		//case 3:
		//	{
		//		Display(&s);
		//	}
		//	break;
		case 4:
				printf("***Exit***\n");
			break;
		}
		printf("****************************\n");
	}
	while(ch<5);
	return 0;
}

int manue (int ch)
{
	printf("\n1:PUSH\n2:POP\n3:Display\n4:Quit\n");
	printf("Please Enter your Choice:\t");
	scanf("%d",&ch);
	printf("\n");
	return (ch);
}


void PUSH (struct stack *ps,int x)
{
	if(ps->top==STACKSIZE-1)
	{
		printf("stack overflow");
	}
	else 
		ps->items[++(ps->top)]=x;
	return ;
}


int POP(struct stack *ps)
{
	if(empty(ps))
	{
		printf("stack underflow");
	}
	else
		return (ps ->items[ps->top--]);
}


int empty (struct stack *ps)
{
	if (ps->top==-1)
		return true ;
	else
		return false;
}





//void Display(struct stack *ps)
//{
//	for(i=0;i<n;i++)
//	{
//		printf("");
//	}
//}

