You could make a function similar to this:
Code:
bool CheckForDupes(int iTest)
{
bool RetVal=false;
for(int i=0;i<10;i++) //of course, i<? would be your array size
{
if(stan[i].GetID()==iTest)
{
RetVal=true; //duplicate found;
}
}
return(RetVal);
}
then use this function like this:
Code:
int NewID, i=0;
while(i<10)
{
cin>>NewID;
if(CheckForDupes(NewID))
{
cout<<"Enter another ID. This one already exists."<<"\n";
}
else
{
stan[i].SetID(NewID);
i++;
}
}
This is basically what I PM'ed you except that I added the while loop here for a little more clarity. Hope this helps.