Sudhanshu Sharma
Sudhanshu Sharma answered question
/* circular queue program using pointer*/
/* every case is tested and shown in program*/ #include<iostream>
using namespace std;
struct node
{
 int data;
 node *link;
};
class cirque
{
private : Node *front,*rear;
    int count;
public:   cirque();
    void push(int n);
    void pop();
    void display();
    ~cirque();
};
cirque::cirque()
{
 front=rear=NULL;
 count=0;
}
void cirque::push(int n)
{
 node *temp;
 temp=new node;
 if(temp==NULL)
 {
  cout<<"memory is less";
  return;
 }
 temp->data=n;
 if(front==NULL)
 {
  front=rear=temp;
 }
 else
 {
 rear->link=temp;
 rear=rear->link;
 }
 rear->link=front;
 count++;
 
}
void cirque::pop()
{
 if(front==NULL)
 {
  cout<<"ciccular queue is empty";
  return;
 }
 node *temp;
 temp=front;
 cout<<endl<<"deleted item is"<<front->data;
 if(count>0)
 front=temp->link;
 rear->link=front;
 count--;
 delete temp;
}
void cirque::display()
{
 if(front==NULL)
 {
  cout<<endl<<"queue is empty";
  return;
 }
 int local = count;
 node … Read more