notation.cpp

Large floating-point numbers are printed in scientific notation by default; small floating-point numbers can be forced to print in scientific notation.

#include <iostream>
using namespace std;

int main()
{
	cout << 23.5 << endl;
	cout << 1000000.0 << endl;
	cout << 6.0221413e23 << endl;

	cout << endl;

	cout << fixed << 23.5 << endl;
	cout << fixed << 1000000.0 << endl;
	cout << fixed << 6.0221413e23 << endl;

	cout << endl;

	cout << scientific << 23.5 << endl;
	cout << scientific << 1000000.0 << endl;
	cout << scientific << 6.0221413e23 << endl;

	return 0;
}
Output:
23.5
1e+006
6.02214e+023

23.500000
1000000.000000
602214130000000020000000.000000

2.350000e+001
1.000000e+006
6.022141e+023