Namespaces
Variants

std:: showpoint, std:: noshowpoint

From cppreference.net
< cpp ‎ | io ‎ | manip
Input/output manipulators
Floating-point formatting
showpoint noshowpoint
Integer formatting
Boolean formatting
Field width and fill control
Other formatting
Whitespace processing
Output flushing
Status flags manipulation
Time and money I/O
(C++11)
(C++11)
(C++11)
(C++11)
Quoted manipulator
(C++14)
定義済みヘッダー <ios>
std:: ios_base & showpoint ( std:: ios_base & str ) ;
(1)
std:: ios_base & noshowpoint ( std:: ios_base & str ) ;
(2)

浮動小数点出力における小数点文字の無条件の包含を有効または無効にします。入力には影響しません。

1) ストリーム str 内の showpoint フラグを有効化します。 str. setf ( std:: ios_base :: showpoint ) を呼び出した場合と同様の効果があります。
2) ストリーム str 内の showpoint フラグを無効にします。これは str. unsetf ( std:: ios_base :: showpoint ) を呼び出した場合と同様の効果があります。

これはI/Oマニピュレータであり、 out << std :: showpoint のような式で呼び出すことができます( out std::basic_ostream 型の場合)。または、 in >> std :: showpoint のような式で呼び出すこともできます( in std::basic_istream 型の場合)。

小数点として使用する文字は、出力時にストリームにimbueされたロケールのnumpunctファセットによって決定されます。詳細は std::num_put::put で説明されています。

目次

パラメータ

str - I/Oストリームへの参照

戻り値

str (操作後のストリームへの参照)。

#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 フラグを設定
(関数)