For the most part i feel like i understand it but would just like to check whether my understanding is sound or flawed.
These two sections of code in particular are my main issue
while (used.find(guess) != string::npos)
Does this mean, we are searching for 'used' using 'find' in the 'guess' and we do so until the end of the string, if we don't reach the end of the string then we have a match and we request a new character.
if (THE_WORD.find(guess) != string::npos)
Does this mean, we are searching for any of the letters in 'THE_WORD' using 'find' in 'guess' and we do so until the end of the string, if we don't reach the end of the string then we have a match and move forward.
npos basically means "not a position", which in this context means not found.
For the while loop, it means keep looping while a match is found, a match being found if they used that word already. At first loop the used would be empty, so the nothing would be found. Every time they try again, if the re-use a word, it is found, and the loop repeats.
In the other clause, the "THE_WORD" string, if not found, they failed the guess. Fashioned as != npos, that's "not - not found", which means found ;)