Last active
August 16, 2018 20:25
-
-
Save blippy/4f721504c717a6614bf6a537e5197c7e to your computer and use it in GitHub Desktop.
Format a double for output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| std::string dout(double d) | |
| { | |
| std::ostringstream s; | |
| s.precision(2); | |
| s.width(10); | |
| s << std::fixed; | |
| s << d; | |
| return s.str(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#include <sstream>