Lecture 43 Challenge

This is how I did my challenge:
main.cpp

fBullCowGame.cpp

It works but there is an issue after you hit play again that it says:
Try 1 What is your guess: Please enter a 5 letter word

Try 1 what is your guess:
like if its trying to validate a guess that isn’t there. Well I almost had it.
Have a great day everyone.


Edit: ok after changing the code to match the video I still get the:
Try 1 What is your guess: Please enter a 5 letter word

Try 1 what is your guess:
for some reason when you play again it skips the cin prompt the first time and I don’t know why. Any help is appreciated. Here is my code:
main.cpp
fBullCowGame.cpp
fBullCowGame.h

Only difference I can think of from my code to yours is that I don’t have getline() marked as std::getline() in your GetValidGuess().

Edit: Actually, mine was doing the same thing, but testing the correct answer and therefore asking to play again… again. If I reset Guess to blank the line after the BCGame reset, it functioned properly.

1 Like

Hi @EpicSauce8 thanks for the feedback. I tried that but I still have the same issue. The game is skipping the cin prompt the second playthrough(and every playthrough except from the first) for some reason. I’ll keep digging. Have a great day.

Edit: Ok so I managed to fix my issue. I fixed it by removing the getline() command and just leaving it as cin since the game only requires the player to put in one word. Of course now that means if the player where to type more words with spaces in between then it would only take the first word but I would rather have that then what I had with it skipping the getline() command. It doesn’t make sense why it’s happening and until I do this will have to do.

Privacy & Terms