Hi everyone
Once again I am struggling with what should be a simple operation.
I store prices as pence in an array that is type float.
I have a quantity that is type float.
I multiply the two together and get the correct answer, eg 159.00000 x 2.0000000 = 318.00000
I now divide by 100 to bring to GBP
318.00000/100 = 3.1800001
I am not concerned about the difference being slightly over, but I want to print just to 2 dp, so I want £3.18 and so I could truncate to 3.18.
However This is a problem when answer slightly out the other way,
3.1799999 does not truncate ok.
I have looked at the currency help but I cannot see how to use it,( my knowledge of C++ tends towards zero).
I would really like to use currency so that I can easily use GBP, Euro or USD.
Help please!!
uff