fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main() {
  6. double number = 12;
  7.  
  8. // Set precision to 2 decimal places using std namespace
  9. cout << fixed <<setprecision(2) << number << endl;
  10. //fixed setprecision(2)
  11.  
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
12.00