Hello there...The rest of my code is working fine so I'll try not to bother you with the whole thing. If the lottery or user numbers have multiples of the same number the match counts it as another match. My question is how do I make my findMatches function only count one match? ie user 2 0 0 0 0 compared to lottery 3 2 2 5 2 = 1 match.....
1 2 3 4 5 6 7 8 9 10 11
int findMatches(int lottery[], int user[], int size)
{
int numMatches = 0;
for (int choice = 0; choice < ARRAY_SIZE; ++choice)
{ for (int i = 0; i < ARRAY_SIZE; i++)
if (user[choice] == lottery[i])
numMatches++;
}
return numMatches;
}
example:: matched 3 different numbers
Enter five numbers 0 through 9 for lottery numbers
Enter Number1: 6
Enter Number2: 1
Enter Number3: 4
Enter Number4: 0
Enter Number5: 0
Your numbers:
6 1 4 0 0
Lottery numbers:
6 1 4 8 9
You matched 3 numbers.
Press any key to continue . . .
example:: matched 1 number to 3 of same type
Enter five numbers 0 through 9 for lottery numbers
Enter Number1: 2
Enter Number2: 0
Enter Number3: 0
Enter Number4: 0
Enter Number5: 0
Your numbers:
2 0 0 0 0
Lottery numbers:
3 2 2 5 2
You matched 3 numbers.
Press any key to continue . . .