How to format a long double number in C++ to display as many digits as possible.
Hi guys.
I am studying C++. And I have wrote a program which calculate with long double number. My goal is not to dis play the point in the number. I mean: dislay Code:
199999 Code:
2.00e+3 How can I do so with C++. |
Use a fixed point style and set the precision to 0:
Code:
#include <cstdio> Code:
Double (raw) = 1234.57 |
It work, thank you!
|
Please explain the code for me, I am new to C++
|
The code modifies the output stream directly for the subsequent write by changing the values of base_ios. If you want the change to remain persistent, you need to use manipulators. The concept is well documented in many books including Stroustrups. But for one good online resource look at:
http://www.cplusplus.com/ref/iostream/ios_base |
All times are GMT -5. The time now is 04:31 AM. |