How to check for duplicates in an array

Nov 17, 2013 at 1:22am
Hey guys I am currently taking a class for c++ and one of problems I for an assignment is that I have to take 7 values from the user but they cannot be duplicates. I am having trouble writing the code so that when a duplicate is found it alerts the user and they have to enter another number. This is the function that I have so far. Any help would be appreciated!

1
2
3
4
5
6
7
8
9
 void getLottoPicks(int picks[], int size)
{
	cout << "Please enter your 7 lotto number picks between 1 and 40." << endl;
	
        for(int count = 0; count < size; count ++)
	{
		cin>>picks[count];
        }
}
Nov 17, 2013 at 1:57am
See http://www.cplusplus.com/forum/beginner/116745/#msg637127

The difference in your case is that the candidate number is one that is accepted from user input (instead of one that is randomly generated).
Topic archived. No new replies allowed.