#include using namespace std; #define SIZE 5 //creating the queue using array int A[SIZE]; int front = -1; int rear = -1; //function to check if the queue is empty bool isempty() { if(front == -1 &&...


#include


using namespace std;


#define SIZE 5



//creating the queue using array


int A[SIZE];


int front = -1;


int rear = -1;



//function to check if the queue is empty


bool isempty() {


if(front == -1 && rear == -1)


return true;


else


return false;


}



//function to enter elements in queue


void enqueue ( int value ) {


//if queue is full


if ((rear + 1)%SIZE == front)


   cout<"queue is="" full="">


else {


 //now the first element is inserted


 if( front == -1)


    front = 0;


//inserting element at rear end


rear = (rear+1)%SIZE;


  A[rear] = value;


}


}



//function to remove elements from queue


void dequeue ( ) {


if( isempty() )


 cout<"queue is="">


else


//only one element


if( front == rear )


 front = rear = -1;


else


 front = ( front + 1)%SIZE;


}



//function to show the element at front


void showfront() {


if( isempty())


cout<"queue is="">


else


cout<"element at="" front="">


}



//function to display the queue


void displayQueue() {


if(isempty())


 cout<"queue is="">


else {


 int i;


 if( front <= rear="" )="">


  for( i=front ; i<= rear="" ;="">


  cout


 }


 else {


  i=front;


  while( i < size)="">


  cout


  i++;


  }


  i=0;


  while( i <=>


  {


  cout


  i++;


  }


 }


}


}




//function to check if Queue is empty


// emptyCheck(){




// }




//function to check if Queue is full





//function to purge the Queue


void purge_queue(){


   cout<"deleting the="" entire=""><>


   delete[] isempty();


   exit(1);


}










This is a Queue Program using Circular Array.

I would like to know how


can I implement the rest of these functions :






  1. Function to check if the Queue is empty?




  2. Function to check if the Queue is Full




  3. Function to purge or Destroy the Queue









Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here