#include<stdio.h> #include<conio.h> #include<stdlib.
h> void main() { int front=-1,rear=-1,queue[10],size=10,n,i; clrscr(); char ch; printf("do u want to enter element in queue y/n \n"); ch=getch(); while(ch=='y' ch=='Y') { printf("enter data\n"); scanf("%d",&n); if(front==-1) { front++; queue[front]=n; rear++; } else { if(rear==size-1) { printf("overflow"); getch(); exit(0); } rear++; queue[rear]=n; } printf("want to add y/n\n"); ch=getch(); } //display of elements// printf("this is printing\n"); for(i=front;i<=rear;i++) { printf("%d\t",queue[i]); } //deletion in queue// printf("want to delete y/n\n"); ch=getch(); while(ch=='y' ch=='Y') { if(front==rear) { front=rear=-1; printf("underflow"); getch(); exit(1); } else { printf("item deleted is %d",queue[front]); front=front+1; } printf("want to delete y/n"); ch=getch();
} //display of elements// printf("this is printing\n"); for(i=front;i<=rear;i++) { printf("%d\t",queue[i]); } getch(); }