#include "iostream"
#include "iomanip"
using namespace std;
int main()
{
system("chcp 65001");
// c语言风格的字符串
char s1[] = "helloworld01"; // 字符数组的形式,无法重新赋值
const char *s2 = "helloworld02"; // 指针形式的字符串
// c++语言风格的字符串
string s3 = "helloworld03"; // c++ string 类型的字符串
// s1 = "001";
s2 = "002";
s3 = "003";
cout << s1 << endl;
cout << s2 << endl;
cout << s3 << endl;
return 0;
}
c++数据类型之字符串
最新推荐文章于 2025-06-14 22:47:34 发布