hey, just wondering if anyone could please tell me why this will not print a decimal value for d2:
I've tried switching 2 to 2.000000000 but it makes no difference. for some reason it refuses to print a value with a decimal point for the value of d2 (which is declared as a double) . a value printed of 6.000000000 is what I'm looking for here.
i = (int)2 * p;
f = 2 * p;
d2 = 2 * p;
printf("i (2*pi)\t%d\t\t%f\t%d\n", i, f, d2);
p is declared as a double and assigned 3.140000000, since the math.h header in my MSVC++ 6 doesn't seem to define a constant for pi (it says its M_PI on msdn, but when I use it I get "undeclared identifier" for M_PI, and yes math.h is included ).
yes, I realize there will be truncation here, but it is not important for this program.
thanks in advance!