Does anyone know of a easy way to separate or display numbers to the left of the decimal point

like separate: 10.5

into 10 and 5?

Printable View

- 02-15-2002UnregisteredAlternative to % int division
Does anyone know of a easy way to separate or display numbers to the left of the decimal point

like separate: 10.5

into 10 and 5? - 02-15-2002Shiro
Uhm. Well, I think that

x = 10.5;

a = (int) x; /* = 10 */

y = (int)(x * 10.0); /* = 105 */

z = y - 10 * a; /* = 5 */ - 02-15-2002Salem
The modf function in math.h does just that

- 02-15-2002sean
I realize this is a dumb comment, but does anyone else think that the % in the subject line looks like a 96?

- 02-16-2002swoopy
Yeah, I see it now.

- 02-16-2002UnregisteredQuote:

*Originally posted by Salem*

**The modf function in math.h does just that**

- 02-16-2002tim545666
Yeah % does look like 96 if you stare at it. I've never noticed that before.