left
原因不是宽度的文本相同,如宽度输出出现与左边距中刷新流。
ios_base& left(
ios_base& _Str
);
参数
- _Str
引用类型到 ios_base对象,或者从 ios_base继承的类型。
返回值
为_Str 派生的对象的引用。
备注
操控程序有效调用 _Str.setf(ios_base::left, ios_base::adjustfield),然后返回 _Str。
示例
// ios_left.cpp
// compile with: /EHsc
#include <iostream>
int main( )
{
using namespace std;
double f1= 5.00;
cout.width( 20 );
cout << f1 << endl;
cout << left << f1 << endl;
}
要求
页眉: <ios>
命名空间: std