Frage

Wie format ich meine Konsolenausgabe so, dass sie in C ++ rechts ausgerichtet ist?

War es hilfreich?

Lösung

Verwenden Sie das Manipulator -Flag std::right

Beispiel

oder

Das funktioniert...

#include<iostream>
using std::cout;
using std::endl;


#include<iomanip>
using std::setw;

int main(){

 int x = 12345;

 cout << "Blah Blah Blah" << endl << setw(80) <<  x << endl;

 system("pause");

 return 0;
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top