fixed

指定浮点数中的小数点固定表示形式显示。

ios_base& fixed( 
   ios_base& _Str 
);

参数

  • _Str
    引用类型到 ios_base对象,或者从 ios_base继承的类型。

返回值

为_Str 派生的对象的引用。

备注

固定 是浮点数的默认显示表示形式。 使用科学记数法,科学 导致浮点数字显示。

操控器有效调用 _Str.setf(ios_base::fixed, ios_base::floatfield),然后返回 _Str。

示例

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

int main( ) 
{
   using namespace std;
   float i = 1.1F;

   cout << i << endl;   // fixed is the default
   cout << scientific << i << endl;
   cout.precision( 1 );
   cout << fixed << i << endl;
}
  

要求

页眉: <ios>

命名空间: std

请参见

参考

iostream 编程

iostreams 约定