lundi 29 octobre 2018

If statement not executing despite being true

I wrote the following code for a problem-solving purpose.

int main()
{
    using namespace std;
    cout << (log(612220032) / log(18)) << " == " << (int)(log(612220032) /log(18)) << endl;

    if((log(612220032) / log(18)) == (int)(log(612220032) / log(18)))
        cout << "Working" << endl;

    return 0;
}

Though both expressions returning 7, the if-statement is not executed.

Aucun commentaire:

Enregistrer un commentaire