//Stack
#include<iostream>
using namespace std;int a[10];
int top;
void Initialize(int a[10])
{
a=new int[10];
top=-1;
}
bool Full(int a[10])
{
if(top==10)
return true;
else
return false;
}
bool Empty()
{
if(top==-1)
return true;
else
return false;
}
void Push(int x,int a[10])
{
if(!Full(a))
{
top++;
a[top]=x;
}
else
cout<<"Full!"<<endl;
}
int Pop(int a[10])
{
if(!Empty())
{
int x=a[top];
top--;
return x;
}
else
{
cout<<"Empty!"<<" ";
return -1;
}
}
void output(int a[10])
{
int i;
for(i=0;i<=top;i++)
{
cout<<a[i]<<" ";
}
cout<<endl;
}
int main()
{
int i;
Initialize(a);
for(i=0;i<10;i++)
{
Push(i,a);
}
output(a);
for(i=0;i<10;i++)
{
cout<<Pop(a)<<" ";
}
cout<<endl;
//output(a);
return 0;
}