### Array Help

I need to have the user enter five numbers and check to make sure none of them are the same.
Here is my code:
 ``123456`` ``````void userNumbers(int usernum [5]){ for (int i=0; i<5; i++){ cout << "Please enter your " << i+1 << " lottery number "; cin >> usernum[i]; } }``````

I had to pass this array to this function. How can i check to make sure the user doesnt enter the same number twice?

I also need to make sure the numbers the user enters are between 1 and 59.
Last edited on
Here are five numbers.

`3 6 12 3 5`

Are any of them the same? How did you tell that? Explain to me how I can work it out for myself.

I know how to compare two numbers to check if there the same... i just dont know how to compare it to an entire array
just give u some concept.

 ``1234567891011121314151617`` ``````int number[5]; int i; for( i = 0 ; i < 5 ; i++ ){ cout << "Enter number " << (i+1) << " : "; cin >> number[i]; for( int j = 0 ; j < i; j++ ){ if( number[i] == number[j] ){ cout << "Number same ! " << endl; i--; } } } for( int j = 0 ; j < 5 ; j++ ){ cout << number[j] << " "; }``````