Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.  
  4. int main() {
  5.  
  6. int acontatore=0;
  7. int bcontatore=0;
  8. int ccontatore=0;
  9. int dcontatore=0;
  10. int fcontatore=0;
  11. int voto=0;
  12.  
  13.  
  14. printf("inserisci il voto ricevuto");
  15.  
  16. scanf("%d", &voto);
  17.  
  18.  
  19. printf("per uscire scrive un numero -1\n");
  20.  
  21. while(voto!=-1) {
  22.  
  23. switch(voto){
  24.  
  25. case 'A':
  26. case 'a':
  27. ++acontatore;
  28. break;
  29.  
  30. case 'B':
  31. case 'b':
  32. ++bcontatore;
  33. break;
  34. case 'C':
  35. case 'c':
  36. ++ccontatore;
  37. break;
  38. case 'D':
  39. case 'd':
  40. ++dcontatore;
  41. break;
  42. case 'F':
  43. case 'f':
  44. ++fcontatore;
  45. break;
  46.  
  47.  
  48. default:
  49.  
  50.  
  51. printf("la lettera che hai inserito è errata");
  52. printf("inserisci un'altro voto");
  53. break;
  54.  
  55.  
  56.  
  57. }
  58. }
  59.  
  60. printf("inserisci il voto");
  61. scanf("%d",&voto);
  62.  
  63. printf("ecco i risultati \n");
  64. printf("A: %d", acontatore);
  65. printf("B: %d", bcontatore);
  66. printf("C: %d", ccontatore);
  67. printf("D: %d", dcontatore);
  68. printf("F: %d", fcontatore);
  69.  
  70. printf("ciao");
  71.  
  72. return 0;
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement