fork download
  1. #include <sstream>
  2. #include <iomanip>
  3.  
  4. int main() {
  5. std::ostringstream ss;
  6. double x = 5;
  7. ss << std::fixed << std::setprecision(2);
  8. ss << x;
  9. std::string s = ss.str();
  10. return 0;
  11. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty