My Code

Here is my code.

main.cpp

type or paste code here#include <iostream>
#include <string>

using namespace std;

void PrintIntro();
string GetGuess();

constexpr int WORD_LENGTH = 5;

int main()
{
	string GuessWord = "";

	PrintIntro();

	for (int count = 1; count <= WORD_LENGTH; count++)
	{
		GuessWord = GetGuess();

		cout << "You entered: " << GuessWord << endl << endl;
	}

	return 0;
}

void PrintIntro()
{
	cout << "Welcome to Bulls and Cows" << endl;
	cout << "Can you guess the " << WORD_LENGTH << " letter isogram I'm thinking of?" << endl << endl;

	return;
}

string GetGuess()
{
	string GuessWord = "";

	// get a guess from the player
	cout << "Enter your guess: ";
	getline(cin, GuessWord);

	return GuessWord;
}

Privacy & Terms