Just a quick question I've long forgotten, is that how do you convert integers into floats
I remember there is something like ftoi, I am looking into something handy like the std
Thanks
Jack
Printable View
Just a quick question I've long forgotten, is that how do you convert integers into floats
I remember there is something like ftoi, I am looking into something handy like the std
Thanks
Jack
You could use a static_cast or add 0.0f
Do you need rounding or truncation?
EDIT: Sorry, pointless question :blush: I was thinking float to int :rolleyes:
static_cast we generally use for this. Well there can be multiple choice to do this as suggested in earlier posts
regards,
Vatsa
www.objectiveprogramming.com
All you should have to do is that. The compiler might warn you about the implicit conversion, but it should work.Code:int i = 5;
float f = i;
Thanks guys, i've found a solution
f = static_cast<float>(i);
Have a nice day!!
Jack