My code is different and I encountered an issue

I have been adding extras to the code to make it feel more user friendly. An example of this is that the game asks for your name.

For the do while loop, I wanted it to skip the PlayIntro and GetPlayerName on any replays.

Using the bool we learned in this lesson, I created an if statement to work out if this was the first run of the game.

Result:

Game runs PrintIntro, GetPlayerName on replay.

Expected result:

Game skips PrintIntro and GetPlayerName and goes straight to NewPrintIntro

Link to Main.cpp

You code does go to the NewPrintIntro!
But your NewPrintIntro calls GetPlayerName again, that’s probably why you are confused…

Otherwise, why don’t you put the PrintIntro and GetPlayerName outside the loop, since you only want them to be executed once?

Thanks. I made a mistake trying to pull the name from the GetPlayerName. I am not sure how to get the string Name from GetPlayerName to NewPrintIntro.

There are many ways you could do that. For instance make GetPlayerName return the Name, and store it in your program. You could then pass it as an argument to NewPrintIntro if you need it there.
Or everything could be combined into a class, but maybe you don’t want to go that far at this point…