mercredi 1 juin 2016

c++ static_cast returns zero

Here is my problem:

#include <stdio.h>
#include <math.h>

int main()
{

    int n = static_cast<int>(50 * (60 / 99));

    printf("Floor: %d\n", n);

    return 0;
}

Why is the function prints 0 when it should print : 30?

becouse the result of calculation is : 30.30303030

Aucun commentaire:

Enregistrer un commentaire