does anyone have a problem where the compiler automatically evaluates fractions to integers? im using ms vc++ 98 and i never noticed this before today. say i have the code:
when it runs, it rounds the number down to zero.Code:double answer; answer=2/5; cout << answer << endl;
but when i do this:
it works fine. why do i have to use type casting just to store a fraction? could it just be my compiler?Code:double answer; answer=(double)2/5; cout << answer << endl;