viernes, 22 de febrero de 2008

How to convert float to int in c++

Let's use static_cast.


float foo = 3.4; // Here the float variable
int myint = static_cast<int>(foo); // Now we have the int part of foo in myint


I hope I had helped you. If you want, you can post your comments and I'll answer you as soon as possible. Thanks!

No hay comentarios:

Publicar un comentario

Escriba su comentario (no necesita registrarse).