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

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

1、

#include<iostream>

using namespace std;
int main()
{
    char ch = 's';
    cout << ch << endl;
    cout << "char所占的内存空间为" << sizeof(char) << endl;
    cout << (int)ch << endl;
    system("pause");
    return 0;
}

2、

#include<iostream>

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

#include<iostream>

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

#include<iostream>

using namespace std;
int main()
{
    cout << "ss\tuuu"<<endl;
    cout << "s\tuuu" << endl;
    cout << "ssssss\tuuu" << endl;
    cout << "sssssss\tuuu" << endl;
    system("pause");
    return 0;
}

3、

#include<iostream>

using namespace std;
int main()
{
    char str[] = "qwer";
    cout << str << endl;
    system("pause");
    return 0;
}

#include<iostream>

using namespace std;
#include<string>
int main()
{
    string str = "qwer";
    cout << str << endl;
    system("pause");
    return 0;
}

4、

#include<iostream>

using namespace std;
int main()
{
    bool flag = true;
    cout << flag << endl;
    cout << "bool所占用的内存空间为:" << sizeof(bool) << endl;
    system("pause");
    return 0;
}

5、

#include<iostream>

using namespace std;
int main()
{
    int a = 0;
    cout << "请输入整型a的值:" << endl;
    cin >> a;
    cout << "整型a的值:" <<a<< endl;
    system("pause");
    return 0;
}

#include<iostream>

using namespace std;
int main()
{
    float f = 0;
    cout << "请输入浮点型f的值:" << endl;
    cin >> f;
    cout << "浮点型f的值:" <<f<< endl;
    system("pause");
    return 0;
}

#include<iostream>

using namespace std;
int main()
{
    char ch = '0';
    cout << "请输入字符型ch的值:" << endl;
    cin >> ch;
    cout << "字符型ch的值:" <<ch<< endl;
    system("pause");
    return 0;
}

#include<iostream>

using namespace std;
#include<string>
int main()
{
    string str = "0";
    cout << "请输入字符串型str的值:" << endl;
    cin >> str;
    cout << "字符串型str的值:" <<str<< endl;
    system("pause");
    return 0;
}

#include<iostream>

using namespace std;
int main()
{
    bool flag = true;
    cout << "请输入布尔型flag的值:" << endl;
    cin >> flag;
    cout << "布尔型flag的值:" <<flag<< endl;
    system("pause");
    return 0;
}

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

上一篇:day 3
下一篇:遍历Map的三种方式

发表评论

最新留言

不错!
[***.144.177.141]2024年04月01日 00时01分47秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章