Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include "TipobaseQueue.h"
- #include "CodaC.h"
- queue c; /*Variabile Coda*/
- main(){
- short s;
- tipobaseQueue elem;
- MakeNullQueue(&c);
- do {
- printf ("\n\nMenu di Operazioni");
- printf ("\n1-Inserimento");
- printf ("\n2-Cancellazione ");
- printf ("\n3-Svuota Coda ");
- printf ("\n4-Ispeziona Elemento in Testa ");
- printf ("\n5-Fine ");
- printf ("\nInserisci la scelta ");
- scanf ("%d", &s);
- FLUSH;
- switch(s){
- case 1 : if (!FullQueue(c)) {
- printf("\nInserisci Elemento ");
- LeggiElementoQueue(&elem);
- EnQueue(&c,elem);
- } else printf ("\nCoda Piena \n");
- break;
- case 2 : if (EmptyQueue(c)) printf ( "\nCoda Vuota\n");
- else {
- DeQueue(&c);
- printf ( "\nPrimo Elemento Estratto\n");
- }
- break;
- case 3 : while (!EmptyQueue(c)) DeQueue(&c);
- break;
- case 4 : if (EmptyQueue(c)) printf ( "\nCoda Vuota\n");
- else {
- printf("\nVisualizza Elemento Testa ");
- elem=Front(c);
- VisualizzaElementoQueue(elem);
- }
- break;
- }
- } while (s<5);
- }
Advertisement
Add Comment
Please, Sign In to add comment