<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>circular queue | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/circular-queue/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 09 Jun 2012 16:43:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C Program for Circular QUEUE Operations – using Array</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/c-program-for-circular-queue-operations-using-array/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/c-program-for-circular-queue-operations-using-array/#comments</comments>
		
		<dc:creator><![CDATA[Ansten Lobo]]></dc:creator>
		<pubDate>Sat, 09 Jun 2012 16:43:01 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[using array]]></category>
		<category><![CDATA[circular queue]]></category>
		<category><![CDATA[c program]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=3306</guid>

					<description><![CDATA[<p>Source: Dr. G T Raju, Professor &#038; Head, Dept. of CSE, RNSIT #define SIZE 5 /* Size of Circular Queue */ int CQ[SIZE],f=-1,r=-1; /* Global declarations */ CQinsert(int elem) { /* Function for Insert operation */ if( CQfull()) printf("\n\n Overflow!!!!\n\n"); else { if(f==-1)f=0; r=(r+1) % SIZE; CQ[r]=elem; } } int CQdelete() { /* Function for</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/c-program-for-circular-queue-operations-using-array/">C Program for Circular QUEUE Operations – using Array</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Source: Dr. G T Raju, Professor &#038; Head, Dept. of CSE, RNSIT</p>
<pre lang="C" line="1">
#define SIZE 5            /* Size of Circular Queue */
int CQ[SIZE],f=-1,r=-1;       /* Global declarations */

CQinsert(int elem)
{                       /* Function for Insert operation */
    if( CQfull()) printf("\n\n Overflow!!!!\n\n");
    else
    {
        if(f==-1)f=0;
        r=(r+1) % SIZE;
        CQ[r]=elem;
    }
}
int CQdelete()
{                      /* Function for Delete operation */
    int elem;
    if(CQempty()){ printf("\n\nUnderflow!!!!\n\n");
    return(-1); }
    else
    {
        elem=CQ[f];
        if(f==r){ f=-1; r=-1;} /* Q has only one element ? */
        else
            f=(f+1) % SIZE;
        return(elem);
    }
}
int  CQfull()
{                     /* Function to Check Circular Queue Full */
    if( (f==r+1) || (f == 0 && r== SIZE-1)) return 1;
    return 0;
}

int CQempty()
{                    /* Function to Check Circular Queue Empty */
    if(f== -1) return 1;
    return 0;
}

display()
{        /* Function to display status of Circular Queue */
    int i;
    if(CQempty()) printf(" \n Empty Queue\n");
    else
    {
        printf("Front[%d]->",f);
        for(i=f;i!=r;i=(i+1)%SIZE)
            printf("%d ",CQ[i]);
        printf("%d ",CQ[i]);
        printf("<-[%d]Rear",r);
    }
}

main()
{                         /* Main Program */
    int opn,elem;
    do
    {
        clrscr();
        printf("\n ### Circular Queue Operations ### \n\n");
        printf("\n Press 1-Insert, 2-Delete,3-Display,4-Exit\n");
        printf("\n Your option ? ");
        scanf("%d",&#038;opn);
        switch(opn)
        {
        case 1: printf("\n\nRead the element to be Inserted ?");
            scanf("%d",&#038;elem);
            CQinsert(elem); break;
        case 2: elem=CQdelete();
            if( elem != -1)
                printf("\n\nDeleted Element is %d \n",elem);
            break;
        case 3: printf("\n\nStatus of Circular Queue\n\n");
            display(); break;
        case 4: printf("\n\n Terminating \n\n"); break;
        default: printf("\n\nInvalid Option !!! Try Again !! \n\n");
            break;
        }
        printf("\n\n\n\n  Press a Key to Continue . . . ");
        getch();
    }while(opn != 4);
}
</pre><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/c-program-for-circular-queue-operations-using-array/">C Program for Circular QUEUE Operations – using Array</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/c-program-for-circular-queue-operations-using-array/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>C program to implement Circular Queue operations</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/c-program-to-implement-circular-queue-operations/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/c-program-to-implement-circular-queue-operations/#comments</comments>
		
		<dc:creator><![CDATA[Drithi]]></dc:creator>
		<pubDate>Wed, 06 Jun 2012 09:15:39 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[circular queue]]></category>
		<category><![CDATA[Data structure]]></category>
		<category><![CDATA[c program]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=3139</guid>

					<description><![CDATA[<p>Below C program implements various Circular Queue operations #include #define max 3 int q[10],front=0,rear=-1; void main() { int ch; void insert(); void delet(); void display(); clrscr(); printf("\nCircular Queue operations\n"); printf("1.insert\n2.delete\n3.display\n4.exit\n"); while(1) { printf("Enter your choice:"); scanf("%d",&#038;ch); switch(ch) { case 1: insert(); break; case 2: delet(); break; case 3:display(); break; case 4:exit(); default:printf("Invalid option\n"); } }</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/c-program-to-implement-circular-queue-operations/">C program to implement Circular Queue operations</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Below C program implements various Circular Queue operations</p>
<pre lang="c" line="1">
#include<stdio.h>
#define max 3
int q[10],front=0,rear=-1;
void main()
{
    int ch;
    void insert();
    void delet();
    void display();
    clrscr();
    printf("\nCircular Queue operations\n");
    printf("1.insert\n2.delete\n3.display\n4.exit\n");
    while(1)
    {
        printf("Enter your choice:");
        scanf("%d",&ch);
        switch(ch)
        {
        case 1: insert();
            break;
        case 2: delet();
            break;
        case 3:display();
            break;
        case 4:exit();
        default:printf("Invalid option\n");
        }
    }
}

void insert()
{
    int x;
    if((front==0&&rear==max-1)||(front>0&&rear==front-1))
        printf("Queue is overflow\n");
    else
    {
        printf("Enter element to be insert:");
        scanf("%d",&x);
        if(rear==max-1&&front>0)
        {
            rear=0;
            q[rear]=x;
        }
        else
        {
            if((front==0&&rear==-1)||(rear!=front-1))
                q[++rear]=x;
        }
    }
}
void  delet()
{
    int a;
    if((front==0)&&(rear==-1))
    {
        printf("Queue is underflow\n");
        getch();
        exit();
    }
    if(front==rear)
    {
        a=q[front];
        rear=-1;
        front=0;
    }
    else
        if(front==max-1)
        {
            a=q[front];
            front=0;
        }
        else a=q[front++];
        printf("Deleted element is:%d\n",a);
}

void display()
{
    int i,j;
    if(front==0&&rear==-1)
    {
        printf("Queue is underflow\n");
        getch();
        exit();
    }
    if(front>rear)
    {
        for(i=0;i<=rear;i++)
            printf("\t%d",q[i]);
        for(j=front;j<=max-1;j++)
            printf("\t%d",q[j]);
        printf("\nrear is at %d\n",q[rear]);
        printf("\nfront is at %d\n",q[front]);
    }
    else
    {
        for(i=front;i<=rear;i++)
        {
            printf("\t%d",q[i]);
        }
        printf("\nrear is at %d\n",q[rear]);
        printf("\nfront is at %d\n",q[front]);
    }
    printf("\n");
}
getch();
</pre><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/c-program-to-implement-circular-queue-operations/">C program to implement Circular Queue operations</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/c-program-to-implement-circular-queue-operations/feed/</wfw:commentRss>
			<slash:comments>12</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to implement circular queue using array</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-circular-queue-using-array/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-circular-queue-using-array/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Wed, 02 Feb 2011 12:16:03 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[circular queue]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[C Programs]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1269</guid>

					<description><![CDATA[<p>#include class cqueue { private : int *arr ; int front, rear ; int MAX; public : cqueue( int maxsize = 10 ) ; void addq ( int item ) ; int delq( ) ; void display( ) ; } ; cqueue :: cqueue( int maxsize ) { MAX = maxsize ; arr = new</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-circular-queue-using-array/">C++ program to implement circular queue using array</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
class cqueue
{
	private :
		int *arr ;
		int front, rear ;
		int MAX;
	public :
		cqueue( int maxsize = 10 ) ;
		void addq ( int item ) ;
		int delq( ) ;
		void display( ) ;
} ;
cqueue :: cqueue( int maxsize )
{
	MAX = maxsize ;
	arr = new int [ MAX ];
	front = rear = -1 ;
	for ( int i = 0 ; i < MAX ; i++ )
		arr[i] = 0 ;
}
void cqueue :: addq ( int item )
{
	if ( ( rear + 1 ) % MAX == front )
	{
		cout << "\nQueue is full" ;
		return ;
	}
	rear = ( rear + 1 ) % MAX;
	arr[rear] = item ;
	if ( front == -1 )
		front = 0 ;
}
int cqueue :: delq( )
{
	int data ;
	if ( front == -1 )
	{
		cout << "\nQueue is empty" ;
		return NULL ;
	}

	data = arr[front] ;
	arr[front] = 0 ;
	if ( front == rear )
	{
		front = -1 ;
		rear = -1 ;
	}
	else
		front = ( front + 1 ) % MAX;
	return data ;
}
void cqueue :: display( )
{
	cout << endl ;
	for ( int i = 0 ; i < MAX ; i++ )
		cout << arr[i] << "  " ;
	cout << endl ;
}
void main( )
{
	cqueue a ( 10 ) ;
	a.addq ( 14 ) ;
	a.addq ( 22 ) ;
	a.addq ( 13 ) ;
	a.addq ( -6 ) ;
	a.addq ( 25 ) ;
	cout << "\nElements in the circular queue: " ;
	a.display( ) ;
	int i = a.delq( ) ;
	cout << "Item deleted: " << i ;
	i = a.delq( ) ;
	cout << "\nItem deleted: " << i ;
	cout << "\nElements in the circular queue after deletion: " ;
	a.display( ) ;
	a.addq ( 21 ) ;
	a.addq ( 17 ) ;
	a.addq ( 18 ) ;
	a.addq ( 9 ) ;
	a.addq ( 20 ) ;
	cout << "Elements in the circular queue after addition: " ;
	a.display( ) ;
	a.addq ( 32 ) ;
	cout << "Elements in the circular queue after addition: " ;
	a.display( ) ;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-circular-queue-using-array/">C++ program to implement circular queue using array</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-circular-queue-using-array/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to implement circular queue ADT using an array</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-circular-queue-adt-using-an-array/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-circular-queue-adt-using-an-array/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Thu, 11 Mar 2010 14:21:47 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[Abstract data type]]></category>
		<category><![CDATA[circular queue]]></category>
		<category><![CDATA[c programs]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1015</guid>

					<description><![CDATA[<p>/* Write a C++ program to implement circular queue ADT using an array */ #include #include #include using namespace std; class cqueue { int q[5],front,rare; public: cqueue() { front=-1; rare=-1; } void push(int x) { if(front ==-1 &#038;& rare == -1) { q[++rare]=x; front=rare; return; } else if(front == (rare+1)%5 ) { cout</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-circular-queue-adt-using-an-array/">C++ program to implement circular queue ADT using an array</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>/* Write a C++ program to implement circular queue ADT using an array */</p>
<pre lang="cpp">
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
class cqueue
{
   int q[5],front,rare;
   public:
      cqueue()
      {
	 front=-1;
	 rare=-1;
      }
      void push(int x)
      {
	 if(front ==-1 && rare == -1)
	 {
	   q[++rare]=x;
	   front=rare;
	   return;
	 }
	 else if(front == (rare+1)%5 )
	 {
	    cout <<" Circular Queue over flow";
	    return;
	 }
	 rare= (rare+1)%5;
	 q[rare]=x;
     }

     void pop()
     {
	if(front==-1 &#038;&#038; rare==	-1)
	{
	  cout <<"under flow";
	  return;
	}
	else if( front== rare  )
	{
	  front=rare=-1;
	  return;
	}
	front= (front+1)%5;
     }
   



 void display()
    {
      int i;
      if( front <= rare)
      {
	for(i=front; i<=rare;i++)
	cout << q[i]<<" ";
      }
      else
      {
	 for(i=front;i<=4;i++)
	 {
	   cout <<q[i] << " ";
	 }
	 for(i=0;i<=rare;i++)
	 {
	    cout << q[i]<< " ";
	 }
      }
    }
};

main()
{

int ch;
cqueue q1;
while( 1)
{
cout<<"\n1.INSERT   2.DELETE   3.DISPLAY    4.EXIT\nEnter ur choice";
cin >> ch;
switch(ch)
{
case 1: cout<<"enter element";
	cin >> ch;
	q1.push(ch); break;

case 2: q1.pop(); break;
case 3: q1.display(); break;
case 4: exit(0);
}
}
}
</pre>
<p><strong>OUTPUT</strong></p>
<p>1.INSERT   2.DELETE   3.DISPLAY    4.EXIT<br />
Enter ur choice1<br />
enter element4</p>
<p>1.INSERT   2.DELETE   3.DISPLAY    4.EXIT<br />
Enter ur choice1<br />
enter element5</p>
<p>1.INSERT   2.DELETE   3.DISPLAY    4.EXIT<br />
Enter ur choice1<br />
enter element3</p>
<p>1.INSERT   2.DELETE   3.DISPLAY    4.EXIT<br />
Enter ur choice3<br />
4 5 3</p>
<p>1.INSERT   2.DELETE   3.DISPLAY    4.EXIT<br />
Enter ur choice2</p>
<p>1.INSERT   2.DELETE   3.DISPLAY    4.EXIT<br />
Enter ur choice3<br />
5 3</p>
<p>1.INSERT   2.DELETE   3.DISPLAY    4.EXIT<br />
Enter ur choice4</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-circular-queue-adt-using-an-array/">C++ program to implement circular queue ADT using an array</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-circular-queue-adt-using-an-array/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
	</channel>
</rss>
