fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. double f = 2345;
  7. cout.precision(2);
  8. cout << f << endl;
  9. cout.setf(ios::fixed,ios::floatfield); // floatfield set to fixed
  10. cout << f << endl;
  11. return 0;
  12. }
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
2.3e+03
2345.00