Code:#include <iostream.h> #include <stdlib.h> #include <math.h> int main() { double result, x = 3.0, y = 2.0; result = pow(x, y); cout << result << endl; system("PAUSE"); return 0; }
The above gives me a result of 9 instead of 9.0
as the book here says.
Same thing w/ abs() or fabs() or floor() etc. The arguments are doubles but the value returned are integers.
I did something wrong or do I need to use the "cout.setf....cout.precision" thingy, but this book doesnt say anything abt it.
Thanx.