Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Implement a function that performs a quick pick function for the Florida Lottery.
- // You are to fill myArray with six unique random numbers from 1 to 53.
- // All the six numbers must be different.
- // You should use getRandomInteger(int) function which is provided to you.
- // You can also use isItemInArray() function which is implemented above.
- void quickPick(int myArray[])
- {
- int value_Compare = 0;
- int digit_Count[6];
- for (int a = 0; a < 6; a++) {
- digit_Count[a] = 0;
- }
- for (int i = 0; i < 6; i++) {
- myArray[i] = getRandomInteger(52) + 1;
- }
- for (int g = 0; g < 6; g++) {
- value_Compare = myArray[g];
- for (int d = 0; d < 6; d++) {
- if (value_Compare == myArray[d]) {
- digit_Count[g] += 1;
- }
- }
- if (digit_Count[g] > 1) {
- myArray[g] = getRandomInteger(52) + 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement