Reputation: 1268
I want to compile a C++ application and I must not use
#include <iomanip>
Is there any alternative way to do that?
Info: I need the setprecision to be 5
Upvotes: 4
Views: 6361
Reputation: 154045
You can set the precision()
directly on the stream, e.g.:
std::cout.precision(5);
Upvotes: 3
Reputation: 12080
Yes you have the ability to use
cout.precision(5);
This does not require
#include <iomanip>
Note: This will set precision for the whole document.
Example:
cout.precision(5);
cout << f;
Upvotes: 13