July 25th, 1999, 04:59 PM
In C++ how may I divide and get a floating point result (ie 7/4 = 1.75). Wound you have to do this, or rather is this the only way?
int a, b;
float answer, answer2;
a=7;
b=4;
answer = a/b;
answer2 = a%b;
answer += answer2;
Is this the only way to do it? Is this the best way if I must compare two division results and I have to be able to compare all of the decimal places also. Thanks!
int a, b;
float answer, answer2;
a=7;
b=4;
answer = a/b;
answer2 = a%b;
answer += answer2;
Is this the only way to do it? Is this the best way if I must compare two division results and I have to be able to compare all of the decimal places also. Thanks!