1 // Ausgabe mit Manipulatoren
  2
  3 #include <fstream.h>
  4 #include <iomanip.h>
  5
  6 int main ()
  7 {
  8 cout << "\x1b[2J";      // Bildschirm löschen
  9 cout << "Verschiedene Formate" << endl;
 10 cout << setfill (‘*’);
 11 cout << setw (7) << 3.14 << endl;
 12 cout << setprecision (3) << 3.14159 << endl;
 13 cout << setiosflags (ios::scientific |
 14         ios::showpos);
 15 //cout << resetiosflags (ios::showpos);
 16 cout << 3.14159;
 17 return 0;
 18 }

Bild 15-13: Setzen von Füllzeichen und Feldbreite