Default right justification : cout justification « Development « C++ Tutorial






#include <iostream>
using namespace std;

int main()
{
  // Use default width.
  cout << "Default format.\n";
  cout << "|";
  cout << 123.45 << "|" << "\n\n";

  // Use default right justification
  cout << "Right-justify in a field width of 12.\n";
  cout << "|";
  cout.width(12);
  cout << 123.45 << "|" << "\n\n";

  return 0;
}








5.7.cout justification
5.7.1.Default right justification
5.7.2.Switch to left justification
5.7.3.Turn on showpos, use left-justification
5.7.4.Turning on internal justification