std::showpoint, std::noshowpoint
提供: cppreference.com
<tbody>
</tbody>
| ヘッダ <ios> で定義
|
||
std::ios_base& showpoint( std::ios_base& str ); |
(1) | |
std::ios_base& noshowpoint( std::ios_base& str ); |
(2) | |
浮動小数点の出力に無条件に小数点が含まれるかどうかを有効化または無効化します。 入力に対しては効果を持ちません。
1)
str.setf(std::ios_base::showpoint) を呼んだかのように、ストリーム str の showpoint フラグを有効化します。2)
str.unsetf(std::ios_base::showpoint) を呼んだかのように、ストリーム str の showpoint フラグを無効化します。これは入出力マニピュレータであり、 std::basic_ostream 型の任意の out に対する out << std::showpoint のような式や std::basic_istream 型の任意の in に対する in >> std::showpoint のような式で呼ぶことができます。
小数点文字として使用される文字は、 std::num_put::put で説明されているように、出力時のストリームに設定されているロケールの numpunct ファセットによって決定されます。
引数
| str | - | 入出力ストリームへの参照 |
戻り値
str (操作後のストリームへの参照)。
例
Run this code
#include <iostream>
int main()
{
std::cout << "1.0 with showpoint: " << std::showpoint << 1.0 << '\n'
<< "1.0 with noshowpoint: " << std::noshowpoint << 1.0 << '\n';
}
出力:
1.0 with showpoint: 1.00000
1.0 with noshowpoint: 1
関連項目
| 指定された ios_base のフラグをクリアします (関数) | |
| 指定された ios_base のフラグを設定します (関数) |