fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. double a = -.0049 ;
  8.  
  9. cout << fixed << setprecision(2) << a << '\n';
  10. int b = rint(a*100);
  11. cout << b / 100 << '.' << setfill('0') << setw(2) << b %100 << '\n';
  12. // lub
  13. a = b / 100.0;
  14. cout << fixed << setprecision(2) << a << '\n';
  15.  
  16.  
  17. }
Success #stdin #stdout 0s 4556KB
stdin
Standard input is empty
stdout
-0.00
0.00
0.00