jeudi 11 août 2016

How to convert integer to double implicitly?

int a{5},b{2},c{9};
double d = (double)a / (double)b + (double)c;

Or I can use static_cast. Either way is verbose, especially when the formula is long. Is there a better solution?

Aucun commentaire:

Enregistrer un commentaire