本文整理汇总了C++中FBullCowGame::SetDifficulty方法的典型用法代码示例。如果您正苦于以下问题:C++ FBullCowGame::SetDifficulty方法的具体用法?C++ FBullCowGame::SetDifficulty怎么用?C++ FBullCowGame::SetDifficulty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FBullCowGame
的用法示例。
在下文中一共展示了FBullCowGame::SetDifficulty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}