自考新教材-p300_4(2)

源程序:

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

int main()
{
double x = 3;
cout << setiosflags(ios::showpoint|ios::fixed)<<x << endl;
cout << setw(4)<<resetiosflags(ios::showpoint|ios::fixed)<< x << endl;
cout << setw(5) << setiosflags(ios::showpos) << x << endl;
system("pause");
return 1;
}

运行结果:

原文地址:https://www.cnblogs.com/duanqibo/p/12262528.html