C++ 输入指定位数的小数

版权声明:转载请注明原文地址即可,要是本文对您有些许帮助的话,请您在下方点个赞,谢谢啦ヾ(o◕∀◕)ノヾ https://blog.csdn.net/qq_33583069/article/details/89741969
#include<iostream>
#include<iomanip>
using namespace std;

int main(){
	double x = 1234567.89,y = 12.34567;
	int n = 1234567,m = 12;
	cout<<setiosflags(ios::fixed)<<setprecision(6)<<x<<endl<<y<<endl<<n<<endl<<m;
	return 0;
} 

猜你喜欢

转载自blog.csdn.net/qq_33583069/article/details/89741969