#include<iostream.h>
void enqueue(int[], int&, int);
int dequeue(int[], int&);
int isempty();
int isfull(const int);
int counter=0;
void enqueue(int myqueue[], int &rear, int x)
{
myqueue[rear]=x;
//cout<<myqueue[rear]<<endl;
rear++;
counter++;
}//ENQUEUE
int dequeue(int myqueue[], int &front)
{ int x;
x=myqueue[front];
front++;
counter--;
return x;
}//DEQUEUE
int isempty()
{
if(counter==0)
return 1;
else return 0;
//return(front
== rear);
}//ISEMPTY
int isfull(const int maxQ)
{
if(counter ==
maxQ)
return
1;
else
return 0;
}//ISFULL
void main()
{
const int maxQ
= 5;
int
myqueue[maxQ];
int front = 0;
int rear = 0;
int x;
char choice;
do{cout<<"SELECT
ONE OF THE FOLLOWING OPTIONS: "<<endl;
cout<<"1-ENQUEUE 2-DEQUEUE
3-ISEMPTY 4-ISFULL 5-QUIT: ";
cin>>choice;
switch(choice)
{
case '1':cout<<"ENTER THE ITEM:
"<<endl;
cin>>x;
if(!isfull(maxQ))enqueue(myqueue, rear, x);
else cout<<"YOU CAN'T
ENQUEUE"<<endl;
break;
case
'2':if(!isempty())cout<<"THE VALUE IS:
"<<dequeue(myqueue, front)<<endl;
else cout<<"YOU CAN'T
DEQUEUE"<<endl;
break;
case '3':
if(isempty())
cout<<"QUEUE
EMPTY."<<endl;
else
cout<<"QUEUE IS NOT EMPTY.
"<<endl;
break;
case '4':
if(isfull(maxQ)==1)
cout<<"QUEUE
FULL."<<endl;
else
cout<<"QUEUE IS NOT FULL.
"<<endl;
break;
case '5':
cout<<"THANK YOU FOR USING OUR MENU!!!!!"<<endl;
break;
default:
cout<<"ENTER CORRECT OPTIONS. "<<endl;
}//SWITCH
}while(choice
!='5');
}//MAIN