fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. int main()
  5. {
  6. std::cout << std::setiosflags(std::ios::scientific) << std::setprecision(1) << 123.456 << std::endl
  7. << std::setiosflags(std::ios::fixed ) << std::setprecision(1) << 123.456 << std::endl;
  8. }
  9.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
1.2e+02
1e+02