本文整理汇总了C++中Code::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Code::GetValue方法的具体用法?C++ Code::GetValue怎么用?C++ Code::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Code
的用法示例。
在下文中一共展示了Code::GetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setCorrectNumber
void GuessResponse::setCorrectNumber(const Code &secret, const Code &guess)
{
// iterate through each, marking when a code place is accounted for
for (int i = 0; i < secret.GetLength(); i++)
{
if (secret.GetValue(i) == guess.GetValue(i))
{
_numberCorrect++;
guessCodeMemberAccountedFor[i] = true;
secretCodeMemberAccountedFor[i] = true;
}
}
}
示例2: setMisplacedNumber
void GuessResponse::setMisplacedNumber(const Code &secret, const Code &guess)
{
bool exitNest = false;
// iterate through each, noting and marking when a code place is accounted for
for (int i = 0; i < guess.GetLength(); i++)
{
exitNest = false;
if (guessCodeMemberAccountedFor[i]) continue;
for (int j = 0; j < secret.GetLength(); j++)
{
if (exitNest || secretCodeMemberAccountedFor[j]) continue;
else if (guess.GetValue(i) == secret.GetValue(j))
{
_numberMisplaced++;
guessCodeMemberAccountedFor[i] = true;
secretCodeMemberAccountedFor[j] = true;
exitNest = true;
}
}
}
}