std::showpoint, std::noshowpoint
来自 cppreference.cn
定义于头文件 <ios> |
||
std::ios_base& showpoint( std::ios_base& str ); |
(1) | |
std::ios_base& noshowpoint( std::ios_base& str ); |
(2) | |
启用或禁用在浮点数输出中无条件包含小数点字符。对输入没有影响。
这是一个 I/O 操纵符,可以与表达式(例如 out << std::showpoint,对于任何 out
类型为 std::basic_ostream 的情况)或表达式(例如 in >> std::showpoint,对于任何 in
类型为 std::basic_istream 的情况)一起调用。
用作小数点的字符由在输出时注入到流中的 locale 的 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 标志(函数) |