#include
#include
#include
#include
#include
using namespace std;
int a[5],f=-1,r=-1;
int insertion()
{
int n;
char s[2];
do{
system("CLS");
cout<<"enter a number /n";
cin>>n;
if((f==0 && r<=5) || (r=f-1)){
cout<<"quene is full /n";
}
else{
if(f==-1){
f=0;
}
if(r>=5){
r=0;}
else{
a[++r]=n;}
}
cout<<"for more insertion press y else n /n";
cin>>s;
}
while(s=="y");
}
int deletion()
{
string s;
do{
system("CLS");
if(f==-1){
cout<<"quene is emphy /n";}
else
{
a[f]=0;
if(f==r)
{
f=-1;
r=-1;
}
else
{
if(f==5-1)
f=0;
else
f++;
}
}
cout<<"For more insertion press y else n /n";
cin>>s;
}
while(s=="y");
}
int output()
{
system("CLS");
if(f==-1){
cout<<"The Circular Queue is Empty";}
else
{
if(r < f)
{
for(int i=f;i<=5-1;i++)
cout< for( int i=0;i<=r;i++)
cout< }
else
{
for( int i=f;i<=r;i++)
cout< cout< }
}}
int main()
{
int x;
cout<<"for insertion press 1 '\n";
cout<<"for deletion press 2 \n";
cout<<"for output press 3 \n";
cin>>x;
switch(x){
case 1:{
insertion();
break;}
case 2:{
deletion();
break;}
case 3:{
output();
break;}
default:{
cout<<"you have entered an invalid number /n";
}
}
return 0;
}
#include
#include
#include
#include
using namespace std;
int a[5],f=-1,r=-1;
int insertion()
{
int n;
char s[2];
do{
system("CLS");
cout<<"enter a number /n";
cin>>n;
if((f==0 && r<=5) || (r=f-1)){
cout<<"quene is full /n";
}
else{
if(f==-1){
f=0;
}
if(r>=5){
r=0;}
else{
a[++r]=n;}
}
cout<<"for more insertion press y else n /n";
cin>>s;
}
while(s=="y");
}
int deletion()
{
string s;
do{
system("CLS");
if(f==-1){
cout<<"quene is emphy /n";}
else
{
a[f]=0;
if(f==r)
{
f=-1;
r=-1;
}
else
{
if(f==5-1)
f=0;
else
f++;
}
}
cout<<"For more insertion press y else n /n";
cin>>s;
}
while(s=="y");
}
int output()
{
system("CLS");
if(f==-1){
cout<<"The Circular Queue is Empty";}
else
{
if(r < f)
{
for(int i=f;i<=5-1;i++)
cout< for( int i=0;i<=r;i++)
cout< }
else
{
for( int i=f;i<=r;i++)
cout< cout<
}}
int main()
{
int x;
cout<<"for insertion press 1 '\n";
cout<<"for deletion press 2 \n";
cout<<"for output press 3 \n";
cin>>x;
switch(x){
case 1:{
insertion();
break;}
case 2:{
deletion();
break;}
case 3:{
output();
break;}
default:{
cout<<"you have entered an invalid number /n";
}
}
return 0;
}