宽度左对齐右对齐和精度

代码-F

#include <iostream>
#include<iomanip>//定义了限制(如宽度,左对齐,右对齐)
#include<string>
using namespace std;
int main()
{
	typedef int o;
	o a = 0, b = 0;
	string c = "你好!!!";
	cout << setfill('&');
	for (a; a <= 9; a++)
		for (b; b <= 9; b++)
		{
			cout << left;//左对齐     cout<<right;右对齐
			cout << setw(15) << "就哈哈哈哈" << endl;
			cout << setw(15) << c << endl;
		}
	double i = 9.56541786746374;
	cout<<fixed<<setprecision(12) << static_cast<double> (i) << endl;
	cin.get();
	return 0;
}

End

~
记录留存

发布了34 篇原创文章 · 获赞 0 · 访问量 520

猜你喜欢

转载自blog.csdn.net/weixin_44228006/article/details/104095107