Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. /* Samuele Mazzoglia
  2. 3°DINFO
  3. 11/12/2018 */
  4.  
  5. //Inclusione librerie
  6. #include<stdio.h>
  7. #include<stdlib.h>
  8. #include<math.h>
  9.  
  10. //Inclusione variabili
  11. char scelta;
  12. char moneta;
  13. float X,T,L,U,A,B,C,D,P;
  14.  
  15. int main(){
  16.  
  17. X= 0.10;
  18. T= 0.20;
  19. L= 0.50;
  20. U= 1;
  21. A= 0.50;
  22. B= 0.80;
  23. C= 1.2;
  24. D= 1.5;
  25. P= 0.60;
  26.  
  27. printf("Che prodotto desideri? ");
  28. scanf("%c",&scelta);
  29.  
  30. if(scelta=='A'){
  31.  
  32. while(A>=0){
  33.  
  34. printf("\n\nInserire X per 0,10, T per 0,20, L per 0,50, U per 1\n");
  35. scanf("%c",&moneta);
  36.  
  37. if(moneta=='X'){
  38. A=A-X;
  39. }
  40.  
  41. if(moneta=='T'){
  42. A=A-T;
  43. }
  44.  
  45. if(moneta=='L'){
  46. A=A-L;
  47. }
  48.  
  49. if(moneta=='U'){
  50. A=A-U;
  51. }
  52.  
  53. if(0<A){
  54. printf("Mancano ancora %f",A);
  55. }
  56.  
  57.  
  58. }
  59.  
  60. }
  61. printf("\n\nErogazione prodotto");
  62.  
  63. return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement