fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. int main()
  5. {
  6. double d = 9.1;
  7. std::cout << d << std::endl;
  8. std::cout.setf ( std::ios::floatfield );
  9. std::cout << std::setprecision(2) << std::fixed << d << std::endl;
  10. }
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
9.1
9.10