#include <sstream> #include <iostream> #include <iomanip> int main() { double d = 12.3456789; std::stringstream ss; ss << std::fixed << std::setprecision( 4 ) << d; std::cout << ss.str() << std::endl; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter