|
-
August 2nd, 2010, 07:32 AM
#6
Re: Program won't output array position
 Originally Posted by ForteX
As it turns out, the while loop that began here:
Code:
while (found = false && first <= last)
needed to be:
Code:
while (first <= last && !found)
It's good to have it fixed now, and thank you very much for your help.
You missed what was really going on. It was pointed out earlier in the thread. By saying found = false, you're assigning the value false to found. You should have written found == false. Had you made that correction, your while loop would be logically equivalent to what you ended up with. By rewriting it as you did, you accidentally got rid of the improper assignment.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|