다음을 통해 공유


오른쪽

Causes text that is not as wide as the output width to appear in the stream flush with the right margin.

ios_base& right( 
   ios_base& _Str 
);

매개 변수

  • _Str
    A reference to an object of type ios_base, or to a type that inherits from ios_base.

반환 값

A reference to the object from which _Str is derived.

설명

left also modifies the justification of text.

The manipulator effectively calls _Str.setf(ios_base::right, ios_base::adjustfield), and then returns _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;
}
  

요구 사항

Header: <ios>

네임스페이스: std

참고 항목

참조

iostream 프로그래밍

iostreams 규칙