fork(1) download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4.  
  5. int main()
  6. {
  7. float num1 = 95.345f;
  8. float num2 = 95.344f;
  9.  
  10. num1 = roundf(num1 * 100) / 100; //rounding two decimals
  11. num2 = roundf(num2 * 100) / 100; //rounding two decimals
  12.  
  13. std::cout << std::setprecision(2) << std::fixed
  14. << num1 << " " << num2 << std::endl;
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 4376KB
stdin
Standard input is empty
stdout
95.35 95.34