hi all,
i have a program that read a float number, but with in the program i need 2 deal with the integer only
ex. 33.78 i need 2 deal with 33
45,01 ----> 45
66.99----->66 and so on

Recommended Answers

All 3 Replies

simple -- just typecast the float to an int. All decimals will be dropped, nothing rounded with this method.

float f = 12.345;
int i = (int)f;

If it's c++ then use static_cast .

that's all what i need.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.