Cin*_*ere 0 c++ pointers function codeblocks
我在尝试编译时遇到标题错误.
#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;
}
Run Code Online (Sandbox Code Playgroud)
这是我的完整代码,我试图让它输出你赢了或输了,50-50
你正在比较function pointer一个integer(5),我想你想调用chance()函数,试试
if (chance() > 5)
^^
Run Code Online (Sandbox Code Playgroud)