Added a "tries" return in the win message

as the summary says… I’ll just paste my code. I’ve only been playing around with C++ as long as I’ve been taking this course. Only other programming/scripting etc… I’ve done is VB/VBA.

void PrintGameSummary()
{
	if (BCGame.IsGameWon())
	{
		std::cout << "Congratulations! You won in " << BCGame.GetCurrentTry();
		std::cout << " tries!\n\n";
	}
	else
	{
		std::cout << "You didn't guess the word. Better luck next time!\n\n";
	}
	return;
}

The problem I had with this though is that it reported back 1 more try than it had actually taken. So I went into the FBullCowCount Struct and moved MyCurrentTry++ down to the GameIsWon If statement like so:

	if (BullCowCount.Bulls == WordLength)
	{
		bGameIsWon = true;
	}
	else
	{
		MyCurrentTry++;
		bGameIsWon = false;
	}

That way a try is only added if you don’t fulfill the requirements to win. Seemed like a more logical place to put it anyway. (after the fact)

I know it’s not much but I figured I’d share.

Privacy & Terms