Output float in default floating-point format : float output « Data Type « C++






Output float in default floating-point format

  
#include <iostream>

using namespace std;

int main()
{
  int x = 100;
  double f = 98.6;
  double f2 = 123456.0;
  double f3 = 1234567.0;

  cout << "f, f2, and f3 in default floating-point format:\n";
  cout << "f: " << f << "  f2: " << f2 << "  f3: " << f3 << endl;

  return 0;
}
  
    
  








Related examples in the same category

1.Set precision for float number
2.Output float number with fixed flag
3.Output float type number with scientific format
4.Change cout width and precision for string and float number output
5.Floating-point values in system default, scientific, and fixed formats.
6.Controlling precision of floating-point values