Last active
August 29, 2015 14:08
-
-
Save binki/324589b3ccee46a699a3 to your computer and use it in GitHub Desktop.
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
#include <sstream> | |
#include <iostream> | |
int main(int argc, const char *const argv []) | |
{ | |
std::stringstream ss; | |
ss.precision(2); | |
int rounded_value = 4; | |
ss << std::fixed << (double)rounded_value; | |
std::string s = ss.str(); | |
std::cout << s << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment