Printing floats is done with %f instead of %d.

See this page for details:

printf - C++ Reference