Vergleiche mit vorigem Beispiel:

#include <iostream.h>
#include <iomanip.h>

void main()
{
  float i = 12.12345, j = 1.12345, k = 123456;
  cout.precision(4);
  cout.setf(ios::fixed);
  cout << "i=" << setw(12) << i << '\n'
       << "j=" << setw(12) << j << '\n'
       << "k=" << setw(12) << k << endl;
}

//Ausgabe:
//i=     12.1235
//j=      1.1235
//k= 123456.0000

previous up next


© 1997 Gottfried Rudorfer, C++-AG, Lehrveranstaltungen, Abteilung für Angewandte Informatik, Wirtschaftsuniversität Wien, 1/11/1999