This document defines a circular queue data structure and provides functions to perform basic queue operations. A circular queue is implemented using a fixed-size array with front and rear pointers. Functions are provided to enqueue an element, dequeue an element, check if the queue is empty or full, and perform sample operations on the queue. The main function allows the user to choose between integer, character, or float queues and calls the operations function to demonstrate usage.
This document defines a circular queue data structure and provides functions to perform basic queue operations. A circular queue is implemented using a fixed-size array with front and rear pointers. Functions are provided to enqueue an element, dequeue an element, check if the queue is empty or full, and perform sample operations on the queue. The main function allows the user to choose between integer, character, or float queues and calls the operations function to demonstrate usage.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online from Scribd
This document defines a circular queue data structure and provides functions to perform basic queue operations. A circular queue is implemented using a fixed-size array with front and rear pointers. Functions are provided to enqueue an element, dequeue an element, check if the queue is empty or full, and perform sample operations on the queue. The main function allows the user to choose between integer, character, or float queues and calls the operations function to demonstrate usage.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online from Scribd
/* Program to perform basic operations on Circular Queues */
/* if Queue is EMPTY then empty=1, otherwise empty=0 */ /* if Queue is FULL then empty=0 and ((rear+1)mod n ) = front */ /* initially rear=n-1 and front =0 */
#include<iostream.h> #include<stdlib.h>
template<class T> class CQueue { int front, rear; int n,empty; T *Q; public: CQueue(); void enQueue(T); T deQueue(); void operations(); int isEmpty(); int isFull(); };
template<class T> CQueue <T>::CQueue() { cout<<"\n enter Size of the Queue:"; cin>>n;