Yes, it will.
in yor case result will be 3.2
If you did: int result = integer * decimal; result will be 3;
Note that in case of
1 2 3
int x = 5;
int y = 2;
double result = x / y;
result will be 2, Because both operands of operator/ in this case are integer and so integer division will be performed. If you want to get 2.5 you should cast at least one operand to double manually: double result = static_cast<double>(x)/y;>
MiiNiPaa:
Question question: I've never understood the difference between: double result = static_cast<double>(x)/y;
and double result = double(x) / y;
jlb:
My compilers been messing with me...People have compiled my code and it works but when i run it through mine it doesn't so I haven't been trusting my compiler too much for the past couple days.
My compilers been messing with me...People have compiled my code and it works but when i run it through mine it doesn't so I haven't been trusting my compiler too much for the past couple days.
Then I really suggest you get it fixed. You can't learn to program in C/C++ with a faulty compiler.