Multiplying decimals

I'm trying to multiply a decimal number with an integer.
C++ keeps rounding up my decimal before multiplying, therefore resulting in an integer answer when i want a decimal answer.

Please help!

u cant do decimals in an int try float
Instead of using int, use either double or float.
1)use type cast
2)if you are saving the result in a variable then use float or double.
I put float instead of int, but it's still rounding it..
closed account (zb0S216C)
ajung90 wrote:
"C++ keeps rounding up my decimal before multiplying"

A computer does not round: it truncates.

Post the expression that's giving the unexpected result; it saves the guess-work.

Topic archived. No new replies allowed.