C++输入输出详解:C++标准输入输出流、文件流、字符串流
http://c.biancheng.net/cpp/biancheng/view/251.html
C++中的IO类(iostream, fstream, stringstream)小结
https://blog.csdn.net/stpeace/article/details/44763009
C++中istream的使用
https://blog.csdn.net/fengbingchun/article/details/51287210
C++编程语言中stringstream类介绍
https://liitdar.blog.csdn.net/article/details/82598039
C++ 输入/输出库
C++ 包含两个输入/输出库:现代的、基于流的输入/输出库和 C 风格输入/输出函数的标准集合。
输入/输出操纵符:控制小数点输出尾数
另外一种方式参考:C++格式化输出小数点后位数
#include <iostream>
#include <iostream>
#include <iomanip>
#include <limits>
int main(void)
{
double num = 1.0;
double num2 = 1.123456789;
std::cout << "with showpoint: " << std::showpoint << num << '\n'
<< "with noshowpoint: " << std::noshowpoint << num << '\n';
std::cout << "num2 default: " << num2 << '\n'
<< "num2 default: " << std::setprecision(8) << num2 << '\n';
return 0;
}
输出:
with showpoint: 1.00000
with noshowpoint: 1
num2 default: 1.12346
num2 default: 1.1234568
其他参考