5.
#include<stdio.h> #include<conio.h> #include<process.h> #define MAX_SIZE 4 int Q[MAX_SIZE], f = -1, r = -1; void main() { int ch,x; void QINSERT(int); void QDELETE(); void QDISPLAY(); while(1) { clrscr(); printf("\n 1.insert \n 2.delete \n 3.display \n 4.exit \n\n enter your choice \n\n"); scanf("%d",&ch); switch(ch) { case 1: printf("\n enter the element to be inserted into the queue \n\n"); scanf("%d",&x); QINSERT(x); break; case 2: QDELETE(); break; case 3: QDISPLAY(); break; case 4: printf("\n Bye!!! See you later \n"); getch(); exit(0); default: printf("\n Invalid choice... try again \n"); } /* end of switch */ printf("\n\n press any key to continue........\n"); getch(); } /* end of while */ } /* end of main */ void QINSERT(int x) { if(r>=MAX_SIZE-1) { printf("\n queue overflow, insertion not possible \n"); return; } r++; Q[r]=x; if(f = = -1) f = 0; printf("\n ele...
Comments
Post a Comment