This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
|
cpp:osteams [2020/05/17 18:16] gthanos |
cpp:osteams [2020/05/17 19:03] gthanos [std::ios::floatfield] |
||
|---|---|---|---|
| Line 48: | Line 48: | ||
| int main() { | int main() { | ||
| cout.setf(std:: | cout.setf(std:: | ||
| - | cout << 16 << endl; | + | cout << " |
| } | } | ||
| </ | </ | ||
| Line 155: | Line 155: | ||
| | | ||
| /* no special formatting specified */ | /* no special formatting specified */ | ||
| + | cout << 0.00000123456789012345678 << endl; | ||
| + | cout << 0.0000123456789012345678 << endl; | ||
| + | cout << 0.000123456789012345678 << endl; | ||
| + | cout << 0.00123456789012345678 << endl; | ||
| + | cout << 0.0123456789012345678 << endl; | ||
| cout << 0.123456789012345678 << endl; | cout << 0.123456789012345678 << endl; | ||
| cout << 123.4567890123456789 << endl; | cout << 123.4567890123456789 << endl; | ||
| Line 160: | Line 165: | ||
| cout << 123456789.0123456789 << endl; | cout << 123456789.0123456789 << endl; | ||
| | | ||
| - | cout << fixed << endl; | + | cout << |
| - | cout << setprecision(1) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(2) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(3) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(4) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(5) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(6) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(7) << 123.456 << endl; | + | cout << |
| | | ||
| - | cout << scientific << endl; | + | cout << |
| - | cout << setprecision(1) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(2) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(3) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(4) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(5) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(6) << 123.456 << endl; | + | cout << |
| - | cout << setprecision(7) << 123.456 << endl; | + | cout << |
| | | ||
| - | cout << showpoint << endl; | + | cout << |
| cout << 30 << " " << | cout << 30 << " " << | ||
| - | cout << noshowpoint << endl; | + | cout << |
| cout << 30 << " " << 1000L << " " << 1000.00 << " " << 3.14159; | cout << 30 << " " << 1000L << " " << 1000.00 << " " << 3.14159; | ||
| - | | + | |
| } | } | ||
| </ | </ | ||