Pay VERY close attention to where your Curly Braces - these guys ----> { } - are located, and how many of them you have. remember you MUST have an opening scope curly brace and a closing scope curly brace on EVERY function/statement No more, no less.
Also, remember to write out your full solution under a void function FIRST before you attempt to enact the function since the compiler only reads from the top down. If you try to write out the function before telling the compiler what the function actually is, it won’t know what the function is and it won’t run.
Here is my working code using a function and asking for 10 guesses and repeating them back…
#include (iostream)
#include (string)
using namespace std;
void PrintIntro(){
//introduce the game
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;
}
//the entry point for our application
int main()
{
PrintIntro();
//get a guess from the player
string GuessOne = "";
string GuessTwo = "";
string GuessThree = "";
string GuessFour = "";
string GuessFive = "";
string GuessSix = "";
string GuessSeven = "";
string GuessEight = "";
string GuessNine = "";
string GuessTen = "";
cout << "Enter your first guess: ";
getline(cin, GuessOne);
// repeat the guess back to them look at 6:15 for screen below line 16
cout << "Your guess was: " << GuessOne << endl;
//get a guess from the player
cout << "Enter your second guess: ";
getline(cin, GuessTwo);
//repeat the guess back to them
cout << "Your second guess was: " << GuessTwo << endl;
cout << "Enter your third guess: ";
getline(cin, GuessThree);
cout << "Your third guess was: " << GuessThree << endl;
cout << "Enter your forth guess: ";
getline(cin, GuessFour);
cout << "Your forth guess was: " << GuessFour << endl;
cout << "Enter your fifth guess: ";
getline(cin, GuessFive);
cout << "Your fifth guess was: " << GuessFive << endl;
cout << "Enter your sixth guess: ";
getline(cin, GuessSix);
cout << "Your sixth guess was: " << GuessSix << endl;
cout << "Enter your seventh guess: ";
getline(cin, GuessSeven);
cout << "Your seventh guess was: " << GuessSeven << endl;
cout << "Enter your eighth guess: ";
getline(cin, GuessEight);
cout << "Your eighth guess was: " << GuessEight << endl;
cout << "Enter your ninth guess: ";
getline(cin, GuessNine);
cout << "Your ninth guess was: " << GuessNine << endl;
cout << "Enter your tenth and final guess: ";
getline(cin, GuessTen);
cout << "Your tenth guess was: " << GuessTen << endl;
cout << endl;
return 0;
}