我的游戏有效,但不是“错误的猜测”部分,“错误”的意思是“即使我的猜测是正确的,它也说我错了,或者它说错了好几次,而不仅仅是一次”。
所以,在我的初学者程序中,这就是我卡住的地方。
char u_recherche;
std::string mot_secret(choisi_ton_mot.length(), '-');
std::string choisi_ton_mot;
int faute = 0;
while (i < 999)
{
//code
for (int i = 0; i < mot_secret.length(); i++) // to check each letter
{
if (choisi_ton_mot[i] == u_recherche) //guess right
{
mot_secret[i] = u_recherche; // if right change "-" to the right letter
std::cout << "lettre trouver ! " << std::endl;
}
}
if (choisi_ton_mot[i] != u_recherche) //guess wrong
{
std::cout << "rater !" << std::endl;
faute++;
}
`