私は一生これを理解することはできません。
int Warrior :: attack ()
{
int hit;
srand(time(0));
if (Warrior.weapon == 6)
int hit = rand() % 5 + 1;
else if (Warrior.weapon == 7)
int hit = rand() % 7 + 4;
else if (Warrior.weapon == 8)
int hit = rand() % 7 + 9;
else if (Warrior.weapon == 9)
int hit = rand() % 7 + 14;
else if (Warrior.weapon == 10)
int hit = rand() % 7 + 19;
std::cout<< "You hit " << hit <<"!\n";
return hit;
}
次のエラーが表示されます: Error C2059: syntax error : '.'
(また、のswitch
代わりにステートメントを使用する必要があることもわかっていますelse if
)
ありがとうございました。