012.数据类型-字符串

时间:2021-09-03 19:58:54   收藏:0   阅读:12
#include <iostream>
#include <string>
using namespace std;
int main()
{
    //1.C风格字符串
    //注意事项char字符串名[]
    //注意事项等号后面双引号
    char str[] = "C语言风格";
    cout << str << endl;

    //2.C++风格字符串
    string str1 = "C++风格";//使用C++风格字符串时候,需要包含头文件<string>
    cout << str1 << endl;


    system("pause");
    return 0;
}

 

原文:https://www.cnblogs.com/ceovs/p/15221663.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!