Advertisement

Converting Float in Int

Started by November 06, 2003 01:04 PM
3 comments, last by Kheteris 21 years, 4 months ago
Is there a way in which I can convert a float to an int?
Yes.

Now if you say what language you are using, I might be able to be more helpful.
Advertisement
aux
Im going to asume your talking about C/C++ since i never heard of aux programming language

for C/C++ to convert a float to an int you use typcasting

if you dont know about typcasting chances are you dont know the c language(wich you should if your trying to do opengl)

im sure i could jsut tell you the answer but it jsut lead to more questions

the C language is easy to learn in a month or so
and learning more as you go
if you have an int that wants a floats vaule (rouned down of course)

//declare and give value
int intvar = floatvar

typecasting would be tossing a (int) infront

(int)floatvar

This topic is closed to new replies.

Advertisement