0

尝试编译时出现标题错误。

#include <iostream>
using namespace std;

int chance()
{
return rand()%11;
}

int main()
{
if (chance > 5)
    cout << "You win." << endl;
else
    cout << "You lose." << endl;
return 0;
}

这是我的完整代码,我试图让它输出你赢或输,50-50

4

1 回答 1

5

你正在比较function pointer一个integer(5),我猜你想调用chance()函数,试试

if (chance() > 5)
          ^^
于 2013-08-24T05:52:54.333 回答