fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. double x = 3.14659265;
  6. std::cout << x << std::endl;
  7. std::cout.precision(2);
  8. std::cout << x << std::endl;
  9. std::cout << std::to_string(x) << std::endl;
  10. return 0;
  11. }
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
3.14659
3.1
3.146593