I can set precision of cout
output using
cout.precision(precision_value);
how can I get the precision value, which i
The function is overloaded. Both overloads return the precision that was set before the call to the function. cout.precision()
may be what you want to query it.
To save it and set it back later:
auto old_precision = cout.precision(temp_precision);
// do stuff
cout.precision(old_precision);
With the function precision().
int main() {
std::cout << std::cout.precision() << std::endl;
return 0;
}