#include "pch.h"
#include <iostream>
#include <string>
using namespace std;
int main() {
constexpr int WORD_LENGTH = 9;
string guess;
// Introduce the game
cout << "Welcome to Bulls and Cows, a fun word game." << endl;
cout << "Can you guess the " << WORD_LENGTH;
cout << " letter isogram I'm thinking of?" << endl << endl;
// Get a guess from the player.
cout << "Please input a valid integer number: ";
getline(cin, guess);
// Repeat the guess back to them.
cout << "You typed in: ";
cout << guess << endl;
return 0;
}
Looks good Kevin, but I do have one question. Your previous cout statements explain that this is a word game, and ask your player to guess an isogram word, but your initial prompt asks for a “valid integer number”?
I am confuzzled, lol.
1 Like
Hello @Aarondhp28,
honestly, no doubt - this is very confusing.
To be more clear, just ignore the content. With this code I only want to demonstrate how to get input from a user and then output it.
Kind regards
Kevin
1 Like