| ajung90 (2) | |
|
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! Thanks | |
|
|
|
| Aramil of Elixia (772) | |
| u cant do decimals in an int try float | |
|
|
|
| degausser (52) | |
| Instead of using int, use either double or float. | |
|
|
|
| Akshit (190) | |
|
1)use type cast 2)if you are saving the result in a variable then use float or double. | |
|
|
|
| ajung90 (2) | |
| I put float instead of int, but it's still rounding it.. | |
|
|
|
| Framework (3116) | |||
A computer does not round: it truncates. Post the expression that's giving the unexpected result; it saves the guess-work. Wazzak | |||
|
|
|||