Do/While loop not looping

This is a discussion on Do/While loop not looping within the C++ Programming forums, part of the General Programming Boards category; Forgive me if this has been asked and answered. I have searched the forums and could not find an answer.
...

Do/While loop not looping

Forgive me if this has been asked and answered. I have searched the forums and could not find an answer.
I am a newbie to programming and have been going through the tutorials and am having a issue with my play again loop.
Here is my code:

The program compiles and runs -- the first time. When it gets to the hilighted part of the code it asks
"would you like to play again? yes/no
Thanks for playing"
It never does go back to the game part of the code. As you can see, I have tried putting cin.getline(playAgain) both above and below the while statement and get the same result.
I know it is something easy but I can not figure out what I am doing wrong.
Thanks in advance for any insight you might be able to provide

When you input an integer using the extraction operator >>, the user enters an integer followed by a newline character which indicates the end of the input. The extraction takes the integer but leaves the newline still in the input stream. Then, when you call cin.getline(), getline takes that leftover newline as its input and doesn't wait for anything new.

Solution is to clear the leftover newline out of the stream right after the integer input. So use cin.ignore to consume and discard that character. Adjust your code as follows:

Thanks so much for the quick answer.
After I adjusted my code as you suggested. I get part of the loop but not all. My output is as follows:

You guessed the number
would you like to play again? yes/no yes
You guessed the number
would you like to play again? yes/no yes
You guessed the number
would you like to play again? yes/no yes
You guessed the number
would you like to play again? yes/no no
Thanks for playing

So it is not reading the entire loop. It does not make sense to me why it would only loop back to the bottom of the loop and not where the" do" statement starts.

On a second note. Can you tell me the difference between strcmp() and the strcmpi() and why strcmpi is better? I assume the i means compare integer but I am confused as to why that would be better

Thanks again for the input. I did put me on the right track.
I needed to reset my variables trycount and guess. Program ran like it was suppose to except it kept the same random number. Reset that and everything is happy (including me)
Appreciate the insight and help from R.Stiltskin, Mr. 777 and Elysia

You will probably see more of me as I get further into this monster called C++
Thanks again