function - error: Iso c++ forbids comparison between pointer and integer [c++] -
i'm getting error in title when trying compile.
#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; }
this full code, i'm attempting have output win or lose, 50-50
you comparing function pointer
integer(5)
, guess want call chance()
function, try
if (chance() > 5) ^^
Comments
Post a Comment