fork(1) download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. int main(void) {
  5. float x,y;
  6. x= 2.3;
  7. y=2.123456;
  8. cout <<x<<endl;
  9. cout << setprecision(2)<<x<<endl;
  10. cout <<y<<endl;
  11. cout << setprecision(2)<<y<<endl;
  12. cout << setprecision(0)<<y<<endl ;
  13. return 0;
  14. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
2.3
2.3
2.1
2.1
2