Hi im making this hangman game, and i got the word they enter as a string and the letter they want to guess as a string, so i was wondering when i use the find function and say i have a word like jelly or something with double letters, what would find return? or how would i use find with the other erase and insert functions if there was double letters? thanks for any help.
As for dealing with n3wbs that want to use multiple letters, you may check to see if the given string size is greater than 1 using strlen or <string>.size();. Honestly, it shouldn't matter. When you check for the string, if the entire string isn't in the word, then it fails to find it. Say we have needle. If I use find to search for ned, it will find one occurance but no others meaning the other e is still hidden like a regular game. If you search for e, it will find the first one, then you have to call it again until npos flag is given. Have fun. :D