Inhaltsverzeichnis

setw()

#include <iomanip>

MANIP setw (int n) 

Ruft strom.width(n) auf.

Parameter

n Anzahl der Zeichen für die nächste formatierte Ein-/Ausgabe

Ergebnis

Rückgabewert: ein implementationsabhängiger Manipulator, der bei str«manip bzw. str»manip die Anweisung str.width(n); ausführt.

Siehe auch

Formatierung mit Manipulatoren.

Beispiel

setw.cpp
#include <iostream>
#include <iomanip>
 
int main()
{
  int i = 25;
  std::cout << std::setw(10) << i << '\n';
}