自考新教材-287

源程序:

//程序7-8

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

double x = 12.34;

cout << "1)" << setiosflags(ios::scientific | ios::showpos) << x << endl;

cout << "2)" << setiosflags(ios::fixed) << x << endl;

cout << "3)" << resetiosflags(ios::fixed) << setiosflags(ios::scientific | ios::showpos) << x << endl;

cout << "4)" << resetiosflags(ios::showpos) << x << endl;     //清除要输出正号的标志

system("pause");

return 0;

}

运行结果:

posted @ 2020-01-27 14:38  bobo哥  阅读(145)  评论(0编辑  收藏  举报