Ok so, I kind of took quite literally that GetGuess MUST return a string. I know from #C that you can add function to output so I try the same and it work but I wanted to be sure that if I do it that way, I won’t have problems later on.
(I’m using namespace std)
void printIntro();
string getGuess();
int main()
{
printIntro();
cout <<"Your guess was "<<getGuess()<<endl;
cout << "Your guess was " << getGuess() << endl;
return 0;
}
void printIntro()
{
constexpr int WORD_LENGTH = 5;
cout << "Welcome to Bulls and Cows, a fun word game " << “\n”;
cout << "can you guess the " << WORD_LENGTH << " letter word, i’m thinking of? " << endl;
return;
}
string getGuess()
{
string guess = “”;
cout << "Enter your guess ";
getline(cin, guess);
return guess;
}