#include <iostream.h>

const int MaxStack=100;
const char EmptyFlag= '\0';
class Stack
{
		 char items[MaxStack];
		 int top;
public:
		 enum {FullStack = MaxStack, EmptyStack = -1};
		 enum {False=0, True= 1};
		 //metodi
		 void Init();
		 void Push(char);
		 char Pop();
		 int Empty();
		 int Full();
		 void DumpStack();
		 };
void Stack::Init()
{      top=EmptyStack;
}
//inserzione di 1 elemento
void Stack::Push(char c)
{   if (Full())
return;
//se c'è spazio si incrementa top e si inserisce l'elemento c
items [++top]=c;
}
//estrazione di 1 elemento
char Stack::Pop()
{    if(Empty())
return EmptyFlag;
else
return items[top--];
}
int Stack::Full()
{    if(top+1 == FullStack)
{   cout<<"Stack pieno a: " << MaxStack <<endl;
return True;
}
else
 return False;
}
int Stack::Empty()
{        if(top==EmptyStack)
			 {  cout << "Stack vuoto" <<endl;
			 return True;
			 }
			 else
				return False ;
				}
void Stack::DumpStack()
{         for(int i=top; i>=0; i--)
cout << items[i] <<endl;
}
void main () {
Stack s1;
s1.Init();
s1.Push('a');
s1.Push('b');
s1.Push('c');
cout <<"Estrai il valore alla testa dello stack: "<<s1.Pop()<< endl;
s1.Push('d');
cout << "Stampare il contenuto dello stack"<<endl;
s1.DumpStack();
}
 