View Single Post
Old Mar 26th, 2008, 7:39 PM   #5
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 864
Rep Power: 3 lectricpharaoh is on a distinguished road
Re: duplicate numbers in arrays

I made a boo-boo:
Quote:
Originally Posted by lectricpharaoh
C++ Syntax (Toggle Plain Text)
  1. if(isValueInArray(n, list, idx)
  2. {
  3. list[idx] = n;
  4. ++idx;
  5. }
You need to invert that condition, and I missed a parenthesis:
if(!isValueInArray(n, list, idx))
{
  list[idx] = n;
  ++idx;
}
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp
lectricpharaoh is offline   Reply With Quote