Fixed format with precision of 7 : double output « Data Type « C++






Fixed format with precision of 7

  
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
  cout << "Default format: " << 123.123456789 << endl;

  cout << "Fixed format with precision of 7: ";
  cout << setprecision(7) << fixed << 123.123456789 << endl;

  return 0;
}
  
    
  








Related examples in the same category

1.Set showpos flag for double
2.Set fixed flag for double value
3.Set the uppercase flag for double value
4.Set scientific flag when outputing double
5.Scientific format with precision of 7
6.Set the precision to 9
7.double: Formatting aligns columns, pads blank spaces with '0' character, and controls precision of answer.