#include"Node.h"
#include"Stack.h"
#include<stdlib.h>

Stack::Stack()
{
    head = NULL;
}


char Stack::pop()
{
   char  x   =   head->get();
   Node*  p   =   head;
   head   =   head->getNext();
   delete  p;
   return  x;
}


void Stack::push (char  x)
{
   Node*   newNode   =   new  Node();
   newNode->set(x);
   newNode->setNext(head);
   head   =   newNode;
}


char Stack::top()
{
   return  head->get();
}


int Stack::isEmpty()
{
   return   ( head   ==   NULL );
}
