We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
int ch,i,item,f=0,r=0,q[5],max=5,c=0; void insert(); void Delete(); void display(); void main() { for(;;) { printf("\n\tMENU\n1.INSERT\n2.DELETE\n3.DISPLAY\n4.EXIT\n"); printf("Enter your Choice\n"); scanf("%d", &ch); switch(ch) { case 1: insert(); display(); break; case 2: Delete(); display(); break; case 3: display(); break; case 4: exit(0);
default: printf("Invalid Input\n"); } }
} void insert() { if(f==r && c==max) { printf("Insertion not possible, due to overflow\n"); } else { printf("Enter the element to be inserted\n"); scanf("%d", &item); q[r]=item; r=(r+1)%max; c++; } } void Delete() { if(f==r && c==0) { printf("Deletion is not possible, due to underflow\n"); } else { printf("The item deleted is %d\n",q[f]); f=(f+1)%max; c--; } } void display() { printf("The circular queue is \n"); for(i=f;i<c+f;i++) { printf("%d",q[i]);
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
include<stdio.h>
include<stdlib.h>
int ch,i,item,f=0,r=0,q[5],max=5,c=0;
void insert();
void Delete();
void display();
void main()
{
for(;;)
{
printf("\n\tMENU\n1.INSERT\n2.DELETE\n3.DISPLAY\n4.EXIT\n");
printf("Enter your Choice\n");
scanf("%d", &ch);
switch(ch)
{
case 1: insert();
display();
break;
case 2: Delete();
display();
break;
case 3: display();
break;
case 4: exit(0);
}
void insert()
{
if(f==r && c==max)
{
printf("Insertion not possible, due to overflow\n");
}
else
{
printf("Enter the element to be inserted\n");
scanf("%d", &item);
q[r]=item;
r=(r+1)%max;
c++;
}
}
void Delete()
{
if(f==r && c==0)
{
printf("Deletion is not possible, due to underflow\n");
}
else
{
printf("The item deleted is %d\n",q[f]);
f=(f+1)%max;
c--;
}
}
void display()
{
printf("The circular queue is \n");
for(i=f;i<c+f;i++)
{
printf("%d",q[i]);
}
The text was updated successfully, but these errors were encountered: