كود:#include <iostream.h> int queout(int,int); int que[10]; main() int k,i,h,t; t=h=-1; i=0; cout<<"\n"; cout<<"The head of your queueis..."<<h; cout<<"\nand the tailis..."<<t; cout<<"\n\n"; k=1; while (k!=0) { cout<<"*********************************\n"; cout<<"***** operation on queue *****\n"; cout<<"*********************************\n"; cout<<"**** 1- Adding to queue ****\n"; cout<<"**** 2- Deleting fromqueue ****\n"; cout<<"*********************************\n"; cout<<"***<<< entere 0 to end >>>***\n"; cout<<"*********************************\n\n"; cout<<"choose one of theabove="; cin>>k; switch(k) { case 1: if (t-h+1==10)cout<<"\n===>>>the queue is full_ this case is[overflow]<<<===\n\n"; else { if((t==9) && (h!=0)) { for (i=0;i<=t-h+1;++i) que[i]=que[h+i]; t=t-h; h=0; cout<<"t="<<t<<"h="<<h; cout<<"\n"; } if((t==-1) && (h==-1)) h=0; cout<<"enter new item="; t++; cin>>que[t]; queout(h,t); } break; case 2: if ((t==-1)&& (h==-1)) cout<<"\n===>>>the queue is nill_ thiscase is [underflow]<<<===\n\n"; else { que[h]=0; h++; if(h>t) { h=t=-1; cout<<"===>>>the queue isnill<<<===\n"; } elsequeout(h,t); } break; } } cout<<"\n***ending program ***"; } intqueout(int h1,int t1) { int j; cout<<"\t %%%%%%%%%%%%%\n\n"; if ((h1==-1) && (t1==-1))cout<<"===>>>the queue is empty<<<===\n"; else { cout<<"head=["<<h1<<"]"; for(j=h1;j<=t1;++j) { if (j==h1) cout<<"\t"; else cout<<"\t\t"; cout<<"queue["<<j<<"]="<<que[j]; if (j==t1)cout<<"\ttail=["<<t1<<"]\n"; else cout<<"\n"; } } cout<<"\n\t %%%%%%%%%%%%%\n"; }