Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. /*******************************************************************
  2. * Program Name:
  3. * Assignment: Homework #
  4. * Due Date: #/#/10
  5. *
  6. * Programmer: Kamar Galloway Student ID: 000918754
  7. * Course: CSC 230 - 002 Lecturer: Dr. Dulberg
  8. *
  9. * Program Description:
  10. *
  11. * Input:
  12. * Output:
  13. * Assumptions/Limitations:
  14. *
  15. *******************************************************************/
  16. #include <stdbool.h> /* C99 only */
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <time.h>
  20.  
  21. #define DICE_ONE 6
  22. #define DICE_TWO 6
  23. #define SIZE 21
  24.  
  25. int main(void){
  26. int roll1[SIZE] = {1,1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,4,5,5,6};
  27. int roll2[SIZE] = {1,2,3,4,5,6,2,3,4,5,6,3,4,5,6,4,5,6,5,6,6};
  28. int EN[SIZE] = {1000,2000,2000,2000,2000,2000,1000,2000,2000,2000,2000,1000,2000,2000,2000,1000,2000,2000,1000,2000,1000};
  29. int count[7][7];
  30.  
  31. int i = 0, j = 0;
  32. int diceOne = -1;
  33. int diceTwo = -1;
  34.  
  35. //INIT COUNTERS
  36. for(i = 0; i < 7; i++){
  37. for(j = 0; j < 7; j++){
  38. count[i][j] = 0;
  39. printf("[%d %d]: %d\n",i,j,count[i][j]);
  40. }
  41. }
  42.  
  43.  
  44. for(i = 0; i < 10; i++){
  45. diceOne = rand() % 6 + 1;
  46. diceTwo = rand() % 6 + 1;
  47.  
  48. count[diceOne][diceTwo]++;
  49.  
  50. printf("%d %d\n", diceOne, diceTwo);
  51.  
  52. }
  53.  
  54.  
  55. printf("Roll\t\tE/N\t\tA/N\n");
  56. for(i = 0; i < SIZE; i++){
  57. printf("%d,%d\t\t%d\t\t%d\n",roll1[i],roll2[i],EN[i],count[roll1[i]][roll2[i]]);
  58. }
  59.  
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement