vendredi 25 mars 2016

% doesn't work after rand() c++

I have to use fmod function instead of % on this code:

int prob = rand();// % 4;
    prob = fmod(prob,4);
    if (prob == 0) {
        shoot = true;
    }
    else shoot = false;

if I use %, prob variable it doesn't get any value on debuger.

Second problem is it never gets inside if, I put breakpoint on if, another on else, and other on shoot = true; the debuger says: The breakpoint will not currently be hit. No executable code of the debugger's target code type is associated.

On other computer the second problem doesn't exist.




Aucun commentaire:

Enregistrer un commentaire