5.浮点型

2020-12-08  本文已影响0人  lxr_

#include<iostream>

using namespace std;

int main()

{

    //float(4字节),double(8字节)

    float f1 = 3.14f;//编译器默认小数为double,之后多做一步转换,加了f之后,则默            认为float

    int a=sizeof(f1);

    cout << a << endl;

    //科学计数法

    float f2 = 3e2;

    cout << f2 << endl;

    float f3 = 3e-2;

    cout << f3 << endl;

    system("pause");

    return 0;

}

上一篇下一篇

猜你喜欢

热点阅读