PROGRAM FOR QUEUE (INSERTION & DELETION)
#include<iostream.h> #include<conio.h> #include<stdio.h> #include<process.h> # define size 5 class queue { int front,rear,a[size]; public: queue() { front=0;rear=0; } void addQ(int item) { if(rear==size) cout<<"Queue is full"<<endl; else a[rear++]=item; } void delQ(int item) { if(front==rear) { cout<<"Queue is empty"<<endl; } else { a[front++]; } } void display() { int i; if(front==rear) { cout<<"\n Queue is empty"; getch(); return; } for(i=front+1;i<=rear;i++) cout<<a[i]<<"\t"; } }; void main() { queue q1; int item; clrscr(); int choice; do { clrscr(); cout<<endl<<"Main menu"; cout<<endl<<"1.Add\t 2.Delete\t 3.Display\t 4.Quit\t&q