std::showpoint, std::noshowpoint
來自 cppreference.com
定義於標頭檔案 <ios> |
||
std::ios_base& showpoint( std::ios_base& str ); |
(1) | |
std::ios_base& noshowpoint( std::ios_base& str ); |
(2) | |
啟用或停用浮點輸出中無條件包含小數點字元。對輸入沒有影響。
這是一個 I/O 運算子,對於任何 std::basic_ostream 型別的 out
,可以透過表示式 out << std::showpoint 呼叫;對於任何 std::basic_istream 型別的 in
,可以透過表示式 in >> std::showpoint 呼叫。
小數點字元由輸出時流中嵌入的區域設定的 numpunct facet 決定,如 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 標誌(函式) |