ios::right|ios::scientific|ios::showpoint : cout float « Development « C++ Tutorial






#include <iostream.h>

main(void)
{
  float a=100100.0, b=0.08;
  cout.setf(ios::right|ios::scientific|ios::showpoint);
  cout.width(20);   
  cout <<(-a*b);
  
  return 0;
}
-8.008000e+003








5.6.cout float
5.6.1.Displaying floating-point values in system default, scientific and fixed formats
5.6.2.ios::right|ios::scientific|ios::showpoint
5.6.3.Displaying numbers in scientific notation
5.6.4.Normal (default) mode; only show 5 digits, including both sides of decimal point
5.6.5.Controlling precision of floating-point values