Advertisement
gaetano_tps

Untitled

Nov 27th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int flip();
  5.  
  6. int main ()
  7. {
  8. int frequencyTesta = 0;
  9. int frequencyCroce = 0;
  10. int roll;
  11. int face;
  12.  
  13. for(roll = 1; roll <= 100; roll++)
  14. {
  15. face = 1 + rand() % 2;
  16.  
  17. switch (face)
  18. {
  19. case 0:
  20. ++frequencyCroce;
  21. break;
  22.  
  23. case 1:
  24. ++frequencyTesta;
  25. break;
  26. }
  27. int flip();
  28. }
  29.  
  30. printf("%s%13s\n", "Face", "Frequency");
  31. printf(" 0%13d\n", frequencyCroce);
  32. printf(" 1%13d\n", frequencyTesta);
  33.  
  34. system("pause");
  35. return 0;
  36. }
  37.  
  38. int flip()
  39. {
  40. int face;
  41.  
  42. if(face == 0)
  43. return 0;
  44. if(face == 1)
  45. return 1;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement