0

```
#include<iostream.h>
#include<conio.h>
#define size 5
int stack[size],top=-1;
void push(int s[size],int &t,int m);
int pop (int s[size],int &t);
void main()
{
clrscr();
cout<<"1-push \n 2-pop \n 3-exit \n";
int x,y;
do
{
cout<<"enter number to choice:";
cin>>x;
switch(x)
{
case 1:
cout << "enter anumber to push in stack \n";
cin >> y;
push(stack, top, y)
break;
case 2:
y = pop(stack, top);
if(y == -1)
cout << "\n empty \n";
else
cout << "\n popis ok \n y=" << y << "\n";
break;
}
} while( x != 3 );
getch();
}
void push(int s[size], int &t, int m)
{
if(t == size-1)
cout << "the stack is full \n";
else
s[++t] = m;
}
int pop(int s[size], int &t)
{
if(t==-1)
return -1;
else
return s[t--];
}
```

*Edited 3 Years Ago by mike_2000_17*: Fixed formatting