mittimus

Funzioni Main CODA

Jul 17th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.94 KB | None | 0 0
  1. #include<stdio.h>
  2. #include "TipobaseQueue.h"
  3. #include "CodaC.h"
  4. queue c; /*Variabile Coda*/
  5. main(){
  6. short s;
  7. tipobaseQueue elem;
  8. MakeNullQueue(&c);
  9. do {
  10. printf ("\n\nMenu di Operazioni");
  11. printf ("\n1-Inserimento");
  12. printf ("\n2-Cancellazione ");
  13. printf ("\n3-Svuota Coda ");
  14. printf ("\n4-Ispeziona Elemento in Testa ");
  15. printf ("\n5-Fine ");
  16. printf ("\nInserisci la scelta ");
  17. scanf ("%d", &s);
  18. FLUSH;
  19. switch(s){
  20. case 1 : if (!FullQueue(c)) {
  21. printf("\nInserisci Elemento ");
  22. LeggiElementoQueue(&elem);
  23. EnQueue(&c,elem);
  24. } else printf ("\nCoda Piena \n");
  25. break;
  26. case 2 : if (EmptyQueue(c)) printf ( "\nCoda Vuota\n");
  27. else {
  28. DeQueue(&c);
  29. printf ( "\nPrimo Elemento Estratto\n");
  30. }
  31. break;
  32. case 3 : while (!EmptyQueue(c)) DeQueue(&c);
  33. break;
  34. case 4 : if (EmptyQueue(c)) printf ( "\nCoda Vuota\n");
  35. else {
  36. printf("\nVisualizza Elemento Testa ");
  37. elem=Front(c);
  38. VisualizzaElementoQueue(elem);
  39. }
  40. break;
  41. }
  42. } while (s<5);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment