how?

Jul 20, 2012 at 1:12pm
i am creating hangman and i have two strings
guess and word
if in word find my guess(using find())
if found it it is replaced(using the replace())
but if there are two same letters it can't find the second

for example if the word is:pap
it will go until pa_
and when i put <p> nothing happen/
so how can make it so to find and the second or third same letter?
Jul 20, 2012 at 1:16pm
find again, starting at the place the last one was found, and keep using find again and again until it doesn't find any more.
Jul 20, 2012 at 1:20pm
^^ Starting at the place the last one was found plus 1.
Jul 20, 2012 at 1:40pm
i didnt understand,can show me?
Jul 20, 2012 at 3:10pm
You were in such a hurry while asking the question.. come on now, explain your problem, show us what you have done so far..
otherwise you wont get much help.
Jul 20, 2012 at 3:14pm
Check out the example in find_first_of()
http://www.cplusplus.com/reference/string/string/find_first_of/
Jul 20, 2012 at 3:19pm
i am creating a hangman
and when i must find a word like this:pop
my program will find po_
so the second p will not find,so what should dO?
TO put fnd first of for the first character and find after?
Topic archived. No new replies allowed.