C++ unfortunately makes formatting a clumsy affair. In C++ a programmer uses tiny objects called manipulators to change the way the stream behaves. You can find the manipulators that C++ has standard in any reference page: C++ I/O Flags [C++ Reference]. It is important that you become familiar with these.
You can also make your own manipulators.
It seems what you want is:
Code:
cout << showpoint << setprecision(2) << foobar;
for all floating point numbers foobar.
It is also nice to remove the format after you are done:
Code:
cout.resetiosflags( ios_base::showpoint );
Forgetting to do that can make output look strange sometimes when you don't expect it.