Forum: Compiler & IDEs Ausgabe über cout


von Ingo L. (grobian)


Lesenswert?

In wie weit ist es möglich über cout Ausgaben zu formatieren bzw. 
Formate wie 5.35898e-008 zu unterdrücken und  als Kommazahl wieder 
auszugeben ?

von Timmo H. (masterfx)


Lesenswert?

cout.setf(ios::XXXX)

wobei XXX folgendes sein kann:
1
left            left-justifies the output
2
right           right-justifies the output
3
showpoint       displays decimal point and trailing zeros for all floating point numbers, even if the decimal places are not needed.
4
uppercase       displays the "e" in E-notation as "E" rather than "e"
5
showpos         displays a leading plus sign before positive values
6
scientific      displays floating point numbers in scientific ("E") notation
7
fixed           displays floating point numbers in normal notation -no trailing zeroes and no scientific notation

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.