fork(1) download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. int main() {
  5. double const number = 123.456789;
  6. for (int i = 0; i != 15; ++i) { std::cout << i << ": " << std::setprecision(i) << number << "\n"; }
  7. return 0;
  8. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
0: 1e+02
1: 1e+02
2: 1.2e+02
3: 123
4: 123.5
5: 123.46
6: 123.457
7: 123.4568
8: 123.45679
9: 123.456789
10: 123.456789
11: 123.456789
12: 123.456789
13: 123.456789
14: 123.456789