Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. void numero_pacchi_mesi(camion *c,int n_trasporti,int *pacchi_mese){
  2.  
  3. int i,j;
  4. int count;
  5.  
  6.  
  7.  
  8. for(i=0;i<12;i++){
  9.  
  10. count=0;
  11.  
  12. for(j=0;j<n_trasporti;j++){
  13.  
  14. if(c[j].mm==i+1){
  15. count+=c[j].n_pacchi;
  16. }
  17. }
  18. pacchi_mese[i]=count;
  19. printf("il numero di pacchi smistati nel mese di %s è %d\n",mesi[i],count);
  20.  
  21. }
  22. return;
  23. }
  24.  
  25. void ordina(int *pacchi_mese){
  26.  
  27. int i;
  28. int t;
  29.  
  30.  
  31. int check;
  32.  
  33. do{
  34. check=0;
  35.  
  36. for(i=0;i<12;i++){
  37.  
  38. if(pacchi_mese[i]>pacchi_mese[i+1]){
  39.  
  40. t=pacchi_mese[i];
  41. pacchi_mese[i]=pacchi_mese[i+1];
  42. pacchi_mese[i+1]=t;
  43.  
  44. }
  45. }
  46.  
  47. }while(check!=0);
  48.  
  49. return;
  50. }
  51.  
  52.  
  53. void stampa_file(int *pacchi_mese,FILE *f){
  54. int i;
  55. for(i=0;i<12;i++){
  56.  
  57. fprintf(f,"%d\n",pacchi_mese[i]);
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement