Converting float into 2 integers

Hi, I have a temperature in a float and I was wondering, is it possible to turn that into 2 integers? for example;

float value = 21.74;

Could I have int A equal 21 and int B equal 74?

Thanks.

Getting 21 is as simple as assigning value to an int.

Getting 74 can be achieved by multiplying value by 100, then modulus dividing it by 100.

Assuming that A and B are declared as integers:

A = value;
// This rounds up the fractional part of "value"
B = (value - A)*100 + 0.5;

Pete

el_supremo:
Assuming that A and B are declared as integers:

A = value;

// This rounds up the fractional part of “value”
B = (value - A)*100 + 0.5;




Pete

Thanks for your help, that worked perfectly!