|
-
December 12th, 2010, 02:13 AM
#4
Re: Array help
In your inner loop (when you are comparing the guess) you are looping from 0 - MAX_GUESSES -- but you only want to loop through the guesses that exist (i.e. you have only filled out guesses from 0 - guess, not 0 - MAX_GUESSES
Also, remember that c++ arrays are zero-based indexes, so you want to loop 0 through (MAX_GUESSES - 1) in your outer loop, or you will run into trouble since guesses[MAX_GUESSES] is not defined. You can fix this simply by using "<" rather than "<=" in your outer loop.
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
|