小编kat*_*070的帖子

类数据成员无法访问

我不能为我的生活弄清楚这一点.

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 …
Run Code Online (Sandbox Code Playgroud)

c++ compiler-errors class syntax-error visual-studio-2010

3
推荐指数
1
解决办法
362
查看次数