This is the same code

that Ben has in the lecture “Clarity is worth fighting for” at 9:49 that he runs, but it will not run on my version of Visual Studio 2017…

I’m positive that my compiler is set up wrong.

#include
#include

using namespace std;

void PrintIntro();
void PlayGame();
string GetGuess();

// the entry point of our application
int main()
{
PrintIntro();
PlayGame();
return 0;
}

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

void PlayGame() {
// loop for the number of turns asking for guesses
constexpr int NUMBER_OF_TURNS = 5;
for (int count = 1; count <= NUMBER_OF_TURNS; count++) {
string Guess = GetGuess();
cout << "Your guess was: " << Guess << endl;
cout << endl;
}
}

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

I’ve double checked it. the only error I get in the error view is on line 15…

then I just ran it again in another folder. and it runs in that one… can I get some help with my version from someone? I have 3 different folders that I run various attempts at code and one will run a code that others will not… I’d really like to know what to look for.

Privacy & Terms