Hello, with this binary search I'm trying to make sure that the user doesn't guess a word twice in my hangman game. It seems to be working correctly except for the fact that I have to enter a letter twice before it gets rejected instead of once? I think that this is a logic error but I can't figure it out... maybe having to do with where my bubblesort(sorts list alphabetically for binary search to work) is placed... ah please help!
Correct me if I wrong
I think it's because of int last = numGuessedLetters + 1; if numGuessdLetters is 0 then mid=(1+0)/2, that can be 0 or 1. If the numGuessedLetters is 0 that mean usedLetters[] is still empty right ? So if (usedLetters[mid] == guess) is invalid because guess is compared with nothing or anything since usedLetters[0] and useLetters[1] is undefined