Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. // Implement a function that performs a quick pick function for the Florida Lottery.
  2. // You are to fill myArray with six unique random numbers from 1 to 53.
  3. // All the six numbers must be different.
  4. // You should use getRandomInteger(int) function which is provided to you.
  5. // You can also use isItemInArray() function which is implemented above.
  6. void quickPick(int myArray[])
  7. {
  8. int value_Compare = 0;
  9. int digit_Count[6];
  10.  
  11.  
  12. for (int a = 0; a < 6; a++) {
  13.  
  14. digit_Count[a] = 0;
  15.  
  16. }
  17.  
  18.  
  19. for (int i = 0; i < 6; i++) {
  20.  
  21. myArray[i] = getRandomInteger(52) + 1;
  22.  
  23. }
  24.  
  25. for (int g = 0; g < 6; g++) {
  26.  
  27. value_Compare = myArray[g];
  28.  
  29. for (int d = 0; d < 6; d++) {
  30.  
  31.  
  32. if (value_Compare == myArray[d]) {
  33.  
  34. digit_Count[g] += 1;
  35.  
  36.  
  37. }
  38.  
  39. }
  40.  
  41.  
  42.  
  43. if (digit_Count[g] > 1) {
  44.  
  45. myArray[g] = getRandomInteger(52) + 1;
  46.  
  47. }
  48.  
  49.  
  50.  
  51. }
  52.  
  53.  
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement