0

(sorry for my english)

So I have this number, for example 15.40, and I have to change it to 40.15 (I don't want to do it with strings). I tried to do something like this:

    float a = 15.40;
    float d;
    d = a*100;
    d %= 100;
    d * = 100;
    d += (int) a;
    d /= 100;

but I got this error on the 4th line (d %= 100;) saying:

error: invalid operands of types 'float' and 'double' to binary 'operator%'

error: in evaluation of 'operator%=(float, double)'

Can I do something about this, or I should stick to strings? Thanks.

Community
  • 1
  • 1

0 Answers0