Up to minute 4:08 Lesson 19

We are asked to copy/paste code when we are trying to get the loop to work. I figured it out after about 3 minutes. No errors and fully functioning! YAY! I figured out my mistakes. I love coding and problem solving. This course is GREAT so far! So this is my code as of that time in the video for the for loop:

#include
#include

using namespace std;

void PrintIntro();
string GetGuessAndPrintBack();

// the entry point for our application
int main()
{
PrintIntro();

for (int count = 1; count <= 5; count++)
    GetGuessAndPrintBack();

cout << endl;
return 0;

}

// introduce the game
void PrintIntro() {
constexpr int WORD_LENGTH = 5;
cout << “Welcome to Bulls and Cows, a fun word game.\n”;
cout << “Can you think of the " << WORD_LENGTH;
cout << " letter isogram I’m thinking of?\n”;
cout << endl;
return;
}

// get a guess from the player
string GetGuessAndPrintBack() {
cout << "Enter your guess: ";
string Guess = “”;
getline(cin, Guess);

// Print guess back
cout << "Your guess was: " << Guess << endl;
return Guess;

}

Privacy & Terms