本文整理汇总了C++中FBullCowGame::GetHiddenWordLength方法的典型用法代码示例。如果您正苦于以下问题:C++ FBullCowGame::GetHiddenWordLength方法的具体用法?C++ FBullCowGame::GetHiddenWordLength怎么用?C++ FBullCowGame::GetHiddenWordLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FBullCowGame
的用法示例。
在下文中一共展示了FBullCowGame::GetHiddenWordLength方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetDifficulty
void SetDifficulty()
{
FText InString;
getline(std::cin, InString);
try
{
int Level = std::stoi(InString);
if (Level < 1 || Level > 5)
{
std::cout << "\nPlease be sure to enter a valid integer between 1 and 5: ";
SetDifficulty();
}
else
{
BCGame.SetDifficulty(Level);
std::cout << std::endl << "Alright, we're working with a " << BCGame.GetHiddenWordLength() << " letter isogram. Let's play the game!\n\n";
}
}
catch (std::invalid_argument& e)
{
std::cout << "\nPlease be sure to enter a valid integer between 1 and 5: ";
SetDifficulty();
}
catch (std::out_of_range& e)
{
std::cout << "\nPlease be sure to enter a valid integer between 1 and 5: ";
SetDifficulty();
}
}
示例2: GetValidGuess
// loop continually until the user gives a valid guess
FText GetValidGuess() {
FText Guess = "";
EGuessStatus Status = EGuessStatus::Invalid_Status;
do {
// get a guess from the player
int32 TryNumber = BCGame.GetCurrentTry();
std::cout << "Try " << TryNumber << " of " << BCGame.GetMaxTries();
std::cout << ". Enter your guess: ";
std::getline(std::cin, Guess);
Status = BCGame.CheckGuessValidity(Guess);
switch (Status){
case EGuessStatus::Wrong_Length:
std::cout << "Please enter a " << BCGame.GetHiddenWordLength() << " letter word. \n\n";
break;
case EGuessStatus::Not_Isogram:
std::cout << "Please enter a word without repeating letters.\n\n";
break;
case EGuessStatus::Not_Lowercase:
std::cout << "Please enter all lowercase letters.\n\n";
break;
default:
break;
}
std::cout << std::endl;
} while (Status != EGuessStatus::OK); // keep looking until we get no errors
return Guess;
}
示例3: GetValidGuess
//get a guess from the user
FText GetValidGuess()
{
EGuessStatus Status = EGuessStatus::Invalid;
FText Guess = "";
do
{
int32 CurrentTry = BCGame.GetCurrentTry();
std::cout << "Try " << CurrentTry << " of " << BCGame.GetMaxTries() << ". Enter your guess: ";
std::getline(std::cin, Guess);
Status = BCGame.CheckGuessValidity(Guess);
switch (Status)
{
case EGuessStatus::Wrong_Length:
std::cout << "Please enter a " << BCGame.GetHiddenWordLength() << " letter word.\n";
break;
case EGuessStatus::Not_Isogram:
std::cout << "Please enter a word without repeating letters.\n";
break;
case EGuessStatus::Not_Lowercase:
std::cout << "Please enter the word using all lowercase letters.\n";
break;
default:
break; // Assume guess is valid
}
std::cout << std::endl;
} while (Status != EGuessStatus::OK); // keep looping until we get no errors
return Guess;
}
示例4: GetGuess
// loop continually until user gives a valid guess.
FText GetGuess()
{
FText InString;
EGuessStatus Status = EGuessStatus::Invalid_Status;
int32 CurrentTry = BCGame.GetCurrentTry();
do
{
std::cout << "Try #" << CurrentTry << "/" << BCGame.GetMaxTries() << " Enter your guess: ";
getline(std::cin, InString);
Status = BCGame.GuessValid(InString);
switch (Status)
{
case EGuessStatus::Wrong_Length:
std::cout << "Please enter a " << BCGame.GetHiddenWordLength() << " letter word.\n\n";
break;
case EGuessStatus::Not_Isogram:
std::cout << "Please enter a word without repeating letters.\n\n";
break;
case EGuessStatus::Not_Lowercase:
std::cout << "Please ensure that your input is all lowercase letters.\n\n";
break;
default:
return InString;
}
} while (Status != EGuessStatus::OK);
return InString;
}
示例5: GetValidGuess
//get the guess and print it back to you
FText GetValidGuess()
{
FText Guess;
EGuessStatus Status = EGuessStatus::Invalid_Status;
do {
int32 CurrentTry = BCGame.GetCurrentTry();
std::cout << "Try " << CurrentTry++ << " of "<< BCGame.GetMaxTries()<<". Take a swag: ";
std::getline(std::cin, Guess);
Status = BCGame.CheckGuessValidity(Guess);
switch (Status) {
case EGuessStatus::Wrong_Length:
std::cout << "Please enter a " << BCGame.GetHiddenWordLength() << " letter word.\n\n";
break;
case EGuessStatus::Not_Isogram:
std::cout << "Make sure you have entered a word without repeating letters.\n\n";
break;
case EGuessStatus::Not_Lowercase:
std::cout << "Please enter an all-lowercase word.\n\n";
break;
default:
//assume the guess is valid
break;
}
} while (Status != EGuessStatus::OK); //keep looping until we get no errors
return Guess;
}
示例6: GetGuess
std::string GetGuess()
{
FText Guess = "";
EGuessStatus Status = EGuessStatus::Invalid;
do
{
int CurrentTry = BCGame.GetCurrentTry();
//get a guess from player
std::cout << "Try " << CurrentTry << " of " << BCGame.GetMaxTries();
std::cout << ". Enter your guess: ";
std::getline (std::cin, Guess);
Status = BCGame.CheckGuessValidity(Guess);
switch (Status)
{
case EGuessStatus::Wrong_Length:
std::cout << "Please enter a " << BCGame.GetHiddenWordLength() << " letter word.\n\n";
break;
case EGuessStatus::Not_Lowercase:
std::cout << "Please enter a lowercase word.\n\n";
break;
case EGuessStatus::Not_Isogram:
std::cout <<"Please enter a word without repeating letters.\n\n";
break;
default:
break;
}
} while (Status != EGuessStatus::OK); //keep looping until we get valid input
return Guess;
}
示例7: GetValidGuess
// Get a guess from the player
FText GetValidGuess()
{
EGuessStatus Status = EGuessStatus::Invalid;
do
{
int32 CurrentTry = BCGame.GetCurrentTry();
std::cout << "Try "<< CurrentTry << ": Enter your guess here: ";
FText GetGuessVal="";
std::getline(std::cin, GetGuessVal);
//CurrentTry++;
Status = BCGame.CheckGuessValidity(GetGuessVal);
switch (Status)
{
case EGuessStatus::Wrong_Length:
std::cout << "please enter a " << BCGame.GetHiddenWordLength() << " letter word.\n";
break;
case EGuessStatus::Not_Isogram:
std::cout << "please enter a word without repeating letters.\n";
break;
case EGuessStatus::Not_Lowercase:
std::cout << "please enter a word in lower case.\n";
break;
default:
return GetGuessVal;
}
} while (Status != EGuessStatus::OK); //Keep looping until we get a valid entry
return 0;
}
示例8: PrintIntro
// Introduce the game
void PrintIntro(){
std::cout << ("\n\nHELLO\n");
std::cout << ("This is using namespace identifiers\n");
std::cout << ("Welcome to Bull and Cows a Fun Game\n");
std::cout << "Can you guess the "<< BCGame.GetHiddenWordLength() <<" letter isogram I'm thinking of?\n";
return;
}
示例9: PrintIntro
void PrintIntro()
{
//introduction
std::cout << "\nWelcome to Bulls and Cows, a fun word game\n";
std::cout << "Can you guess the " << BCGame.GetHiddenWordLength();
std::cout << " letter isogram I'm thinking of?\n";
std::cout << std::endl;
return;
}
示例10: PrintIntro
void PrintIntro()
{
int32 WORD_LENGTH = BCGame.GetHiddenWordLength();
std::cout << "\n\n|||||/--------------------------------------------------------------\\|||||\n";
std::cout << "||||/----------------------------------------------------------------\\||||\n";
std::cout << "||||| Welcome to Bulls and Cows, a fun word game. |||||\n";
std::cout << "||||| Can you get the " << WORD_LENGTH << " letter isogram that I'm thinking of? |||||\n";
std::cout << "||||\\----------------------------------------------------------------/||||\n";
std::cout << "|||||\\--------------------------------------------------------------/|||||\n\n";
return;
}
示例11: PrintIntro
//declaration of function PrintIntro
void PrintIntro()
{
//introduce the game
int32 WORD_LENGTH = BCGame.GetHiddenWordLength();
std::cout << "Welcome to Bulls and Cows :) ";
std::cout << std::endl;
std::cout << "Can you guess this " << WORD_LENGTH << " letter word, i'm thinking of?\n";
std::cout << std::endl;
return;
}
示例12: PrintIntro
void PrintIntro()
{
std::cout << "Welcome to Bulls and Cows, a fun word game.\n";
std::cout << std::endl;
std::cout << " } { ___ " << std::endl;
std::cout << " (o o) (o o) " << std::endl;
std::cout << " /-------\\ / \\ /-------\\ " << std::endl;
std::cout << " / | BULL |O O| COW | \\ " << std::endl;
std::cout << " * |-,--- | |------| * " << std::endl;
std::cout << " ^ ^ ^ ^ " << std::endl;
std::cout << "Can you guess the " << BCGame.GetHiddenWordLength();
std::cout << " letter isogram I'm thinking of?\n";
std::cout << std::endl;
return;
}
示例13: PrintIntro
void PrintIntro() {
// introduce the game
std::cout << "\n\nWelcome to Bulls and Cows\n";
std::cout << " ________________________ \n";
std::cout << " (__) | | \n";
std::cout << " (oo) | Bulls & Cows! | \n";
std::cout << " /-------00 --'|________________________| \n";
std::cout << " / | || \n";
std::cout << " * ||----|| \n";
std::cout << " ^^ ^^ \n\n";
std::cout << "Can you guess the " << BCGame.GetHiddenWordLength();
std::cout << " letter isogram I'm thinking of?\n\n";
return;
}
示例14: GetValidGuess
//get Valid guess from user
FText GetValidGuess()
{
FText Guess = "";
EGuessStatus Status = EGuessStatus::Invalid_Status;
do {
//get a guess from player
int32 CurrentTry = BCGame.GetCurrentTry();
std::cout << "Try " << CurrentTry <<" of " <<BCGame.GetMaxTries() << ".Enter your Guess:";
std::getline(std::cin, Guess);
//checking if the guess is valid
Status = BCGame.IsGuessValid(Guess);
switch (Status)
{
case EGuessStatus::Not_Isogram:
std::cout << "Please Enter a word without repeating letters !" << std::endl;
break;
case EGuessStatus::Lower_Case:
std::cout << "Please Enter all lower case letters !" << std::endl;
break;
case EGuessStatus::Wrong_Lenght:
std::cout << "Please Enter a " << BCGame.GetHiddenWordLength() << " letter Word !" << std::endl;
break;
default:
//Assume that the status is OK
break;
}
std::cout << std::endl;
} while (Status != EGuessStatus::OK); //keep looping until we get no errors or we get Status == OK
return Guess;
}
示例15: PrintIntro
// Introduce the game
void PrintIntro() {
std::cout << "Welcome to Bulls and Cows\n";
std::cout << "Can you guess the " << BCGame.GetHiddenWordLength();
std::cout << " letter isogram I'm thinking of?\n";
return;
}