std::showpoint, std::noshowpoint
来自cppreference.com
输入/输出库
输入/输出操纵符
浮点格式化 | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
整数格式化 | |||||||||||||||||||||||||||||||
布尔格式化 | |||||||||||||||||||||||||||||||
域宽与填充控制 | |||||||||||||||||||||||||||||||
其他格式化 | |||||||||||||||||||||||||||||||
空白符处理 | |||||||||||||||||||||||||||||||
输出冲入 | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
状态标志操纵 | |||||||||||||||||||||||||||||||
时间与金钱 I/O | |||||||||||||||||||||||||||||||
带引号操纵符 | |||||||||||||||||||||||||||||||
(C++14)
|
在标头
<ios>
定义
|
||
std::ios_base& showpoint( std::ios_base& str );
|
(1) | |
std::ios_base& noshowpoint( std::ios_base& str );
|
(2) | |
启用或禁用浮点输出中的无条件小数点包含。在输入上无效果。
这是一个 I/O 操纵符,可用如 out << std::showpoint 的表达式对任何 std::basic_ostream
类型的 out
或用如 in >> std::showpoint 的表达式对任何 std::basic_istream
类型的 in
调用。
由在输出时刻流中感染的 locale 的 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 标志 (函数) |