This is a theoretical question from a software amateur.

I have a float variable x=111.01 and I want to capture the whole and fractional parts into integer variables.

One way I have seen this done is to multiply x by a number, say, 100.

x=x*100; //now x = 11101

and then use integer variables whole and fract...

whole = x/100; //now x=111, which is the whole portion fract = x % 100;

The problem I see here is that x % 100 will return 1, not 0.01

Is there a flaw in my interpretation? How does one manage the issue of the decimal?

One thought: You could know up front there will be 2 digits after the decimal, and if modulo returns a single digit, you would have to insert a 0 in front of the result. Is this what is typically done?