C++ 10.26
发布日期:2022-03-16 03:25:45 浏览次数:25 分类:技术文章

本文共 831 字,大约阅读时间需要 2 分钟。

1、

#include<iostream>

using namespace std;
int main()
{
    cout << "hello world" << endl;
    system("pause");
    return 0;
}

2、

#include<iostream>

using namespace std;
int main()
{
    int a = 10;
    cout << "a=" << a << endl;
    system("pause");
    return 0;
}

3、

#include<iostream>

using namespace std;
#define Day 7
int main()
{
    cout << "一周有" << Day <<" 天"<< endl;
    system("pause");
    return 0;
}

#include<iostream>

using namespace std;
int main()
{
    const int Day = 7;
    cout << "一周有" << Day <<" 天"<< endl;
    system("pause");
    return 0;
}

4、

#include<iostream>

using namespace std;
int main()
{
    float f1 = 3.14f;
    double d1 = 3.14;
    float f2 = 3e1;
    float f3 = 3e-1;
    cout << f1 << endl;
    cout << d1 << endl;
    cout << f2 << endl;
    cout << f3 << endl;
    cout << "f1所占用的空间为" << sizeof(f1) << endl;
    cout << "d1所占用的空间为" << sizeof(d1) << endl;
    system("pause");
    return 0;
}

转载地址:https://blog.csdn.net/zhizhikaodigua/article/details/120978291 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:day 2
下一篇:day 3

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年03月27日 18时34分31秒