First, we print aDouble in various ways in its natural form using the f conversion type, as follows:
printf( "Use of the %%f, %%e, and %%E format specifiers:\n" );
printf( " Specifier Formatted Value\n" );
printf( " %%f[%f] whatever\n",aDouble );
printf( " %%.3f [%.3f] 3 decimal places\n",aDouble );
printf( " %%.9f [%.8f]8 decimal places\n",aDouble );
printf( " %%.0f [%.0f]no decimal places\n",aDouble );
printf( " %%#.0f[%#.0f] no decimal places, but decimal point\n",
aDouble );
printf( " %%15.3f [%15.3f]3 decimals, 15 wide, left aligned]\n",
aDouble );
printf( " %%-15.3f[%-15.3f] 3 decimals, 15 wide, right aligned\n",
aDouble );
With no precision specified, the double value is formatted to six decimal places (the default). The next three statements print aDouble to various precisions...