C++ 输入/输出库

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

其他参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值