格式化控制

版权声明:lixiang666 https://blog.csdn.net/weixin_43838785/article/details/90647159
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
int main()
{
	float f = 20.2;
	cout.setf(ios::scientific | ios::uppercase);
	cout << f << endl;
	cout << cout.flags() << endl;
	cout.flags(ios::showpos);
	cout << cout.flags() << endl;
	cout << f << endl;
	cout.unsetf(ios::showpos);
	cout << f;
	system("pause");
	return 0;
}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43838785/article/details/90647159