0

I successfully built my program and went on to check it using check50 only to discover this

:) helpers.c exists
:) helpers.c compiles
:) finds 42 in {42,43,44}
:) finds 42 in {41,42,43}
:) finds 42 in {40,41,42}
:( finds 42 in {41,42,43,44}
   \ expected an exit code of 0, not 1
:) finds 42 in {40,41,42,43}
:) finds 42 in {39,40,41,42}
:) doesn't find 42 in {39,40,41}
:) doesn't find 42 in {39,40,41,43}
:) finds 42 in {42,40,39,41}

so my question is, what could be wrong in my code that it misbhaves and gives the wrong result, only for one specific find command? why does it give the right answer for all the other commands given by check50 ? help would be appreciated, thank you.

  • How did you correct this line for (int z = i + i; 1 < n - 1; i++){ from your original sort? – DinoCoderSaurus Mar 13 '17 at 4:04
  • I was thinking that it was a sort issue too. (Haven't seen any of the code.) I'd suggest testing with 42, 43, 44, 45. Interesting that it fails with an even number of elements and 42 in the second spot. (I wonder why check50 doesn't include that test?) You might try also to print out the entire sorted list, using all of the test values and see if a flaw emerges. If the sort is fine, then it would definitely be a search issue, likely in the bounds used. – Cliff B Mar 14 '17 at 3:07

You must log in to answer this question.

Browse other questions tagged .