Share via


right

右の余白とストリームのフラッシュに表示されるようにないほど出力の幅と、テキスト。

ios_base& right(
   ios_base& _Str
);

パラメーター

  • _Str
    ios_baseオブジェクト、または ios_baseから型への参照。

戻り値

_Str が派生したオブジェクトへの参照。

解説

は、テキストの位置合わせを変更します。

マニピュレーターは、_Str.setf (ios_base::rightios_base::adjustfield) を呼び出し、_Strを返します。

使用例

// ios_right.cpp
// compile with: /EHsc
#include <iostream>

int main( ) 
{
   using namespace std;
   double f1= 5.00;
   cout << f1 << endl;
   cout.width( 20 );
   cout << f1 << endl;
   cout.width( 20 );
   cout << left << f1 << endl;
   cout.width( 20 );
   cout << f1 << endl;
   cout.width( 20 );
   cout << right << f1 << endl;
   cout.width( 20 );
   cout << f1 << endl;
}
  

必要条件

ヘッダー: <ios>

名前空間: std

参照

関連項目

入出力ストリームのプログラミング

入出力ストリームの規則