1:代码如下:

// 2.11.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
using namespace std;
void main()
{
    float x=20,y=-400.00;
    cout << x <<' '<< y << endl;//输出x,空格,y
    cout.setf(ios::showpoint);    //强制显示小数点和无效0
    cout << x <<' '<< y << endl;
    cout.unsetf(ios::showpoint);
    cout.setf(ios::scientific);    //设置按科学表示法输出
    cout << x <<' '<< y << endl;
    cout.setf(ios::fixed);        //设置按定点表示法输出
    cout << x <<' '<< y << endl;
}
View Code

相关文章:

  • 2021-08-10
  • 2021-10-24
  • 2021-09-15
  • 2022-02-04
猜你喜欢
  • 2021-11-22
  • 2021-04-27
  • 2021-09-05
  • 2022-01-17
相关资源
相似解决方案