In section 2-40th video, another method

when i see a 2-40 lecture, i saw Ben’s method, error checking code using switch statement.

When I gave the lecture to me, I solved it differently than Ben did, but the same result came out.

i did that I left the switch in the PlayGame() Method’s the for statement.

Like that
for (int32 count = 1; count <= MaxTries; count++) {
FText Guess = GetValidGuess();

            switch (Status)
	{
	case Wrong_Length:
		std::cout << "Please enter a " << BCGame.GetHiddenWordLength() << "letter word.\n";
		break;
	case Not_Isogram:
		std::cout << "Please enter a word without repeating letters.\n";
		break;
	case Not_Lowercase:
		std::cout << "Please enter all lower case letters.\n";
	default:
                    FBullCowCount BullCowCount = BCGame.SubmitGuess(Guess);
	        std::cout << "Bulls = " << BullCowCount.Bulls;
	        std::cout << ". Cows = " << BullCowCount.Cows << std::endl << std::endl;
            }

}

This code may simply be compiled and may not be compiled,

because I have already modified the course and corrected it.

but it may be a similar context.

Privacy & Terms