std::showpoint, std::noshowpoint
来自cppreference.com
| 在标头 <ios> 定义
|
||
| |
(1) | |
| |
(2) | |
启用或禁用浮点输出中的无条件小数点包含。在输入上无效果。
1) 如同用调用
str.setf(std::ios_base::showpoint) 启用流 str 中的 showpoint 标志。2) 如同用调用
str.unsetf(std::ios_base::showpoint) 禁用流 str 中的 showpoint 标志。这是一个 I/O 操纵符,可用如 out << std::showpoint 的表达式对任何 std::basic_ostream 类型的 out 或用如 in >> std::showpoint 的表达式对任何 std::basic_istream 类型的 in 调用。
由输出时流所浸染的本地环境的 numpunct 刻面确定用作小数点的字符,如 std::num_put::put 中所描述。
参数
| str | - | 到 I/O 流的引用 |
返回值
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 标志 (函数) |