基本上,healthtwo的条件导致程序停止但由于某种原因而不是健康状况
完整代码:http://en.textsave.org/CmN
if (chance<=rando) {
cout << " " << endl;
cout << "Hit! Dealing " << attackp << " Damage!" << endl;
healthtwo=healthtwo-attackp;
}
else {
cout << " " << endl;
cout << "Miss!" << endl;
}
chance=1+rand()%23;
if (chance<=rando) {
cout << "Comp Used " << comattackname << "!" << " Hit!" << " Dealing " << attackcp << " Damage" << endl;
cout << " " << endl;
healthone=healthone-attackcp;
}
else {
cout << "Comp Used " << comattackname << "!" << " Miss!" << endl;
cout << " " << endl;
}
} while (healthone>=0 || healthtwo>=0);
答案 0 :(得分:1)
这应该是合乎逻辑的和(&&
)。毕竟,你想检查两个参赛者的健康状况是否大于或等于零。