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 操作符,对于任何 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 标志(函数) |