基本的に、プレイヤーとオオカミの両方が、お互いが死ぬまで攻撃し合うようにしたい. しかし、while ループは無限なので、明らかに条件が満たされていません。しかし、私はこれでどこが間違っているのかわかりません if ( Choice1 == 1) // if ステートメントはゲーム全体で使用され、ユーザーがゲームを通じて選択肢を操作できるようにします。
while((Status.health != 0) && (Wolves.health != 0) )
{
int playerAttack = Status.strength + hitPoints() + Rock.attack;
cout<< "This is the player attack" << playerAttack;
Wolves.health = Wolves.health - playerAttack;
cout << "This is the wolves health" << Wolves.health;
if (Wolves.health <= 0)
{
cout << "\nThe wolves are dead\n ";
}
int wolfAttack = Wolves.attack + hitPoints();
Status.health - wolfAttack;
if(Status.health <= 0)
{
gameOver();
}// print out of object health.
}
誰でも助けることができますか?