Hi All,
Can one of you guys give me some advice on the following,
I have 2 float numbers and i want to change them into ints then
find the remander via modulus, this is what i have :-
If i enter 98.33 for float1 & 15.22 for float2Code:#include <iostream.h> #include <stdlib.h> void main() { float float_num1; float float_num2; int int_num3; int int_num4; cout << "1st number:"; cin >> float_num1; cout << "2nd number:"; cin >> float_num2; int_num3 = (int)float_num1; int_num4 = (int)float_num2; cout << int_num3 % int_num4; }
The remainder shuld be 5 (if my maths is right)
But i get the result 8 in my program?
Can anyone see a problem?
Cheers
Boontune



LinkBack URL
About LinkBacks


