#include<iostream.h>
#include<process.h>
#define stack_init_size 12
#define NULL 0
struct Qnode{
int data;
Qnode *next;
};
typedef Qnode * Queueptr ;
class stack
{
public:
int *base;
int *top;
public:
void initstack();
bool stackempty();
int pop();
bool push(int elem);
int gettop();
~stack() { }
};
class queue
{
private:
Queueptr front;
Queueptr rear;
public:
void initqueue();
bool queuempty();
bool enqueue(int data);
int dequeue();
void visit();
~queue() { }
};
void stack::initstack()
{
base=new int[stack_init_size];
if(!base)
exit(0);
top=base;
}
bool stack::stackempty()
{
if(top==base)
return true;
else
return false;
}
int stack::pop()
{
if(stackempty())
return -1;
else
return *--top;
}
bool stack::push(int elem)