美文网首页
5.浮点型

5.浮点型

作者: lxr_ | 来源:发表于2020-12-08 16:20 被阅读0次

    #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;

    }

    相关文章

      网友评论

          本文标题:5.浮点型

          本文链接:https://www.haomeiwen.com/subject/yrdawktx.html