ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 数组 ``` double balance[] = {1000.0, 2.0, 3.4, 7.0, 50.0}; balance[5]=12; std::cout << balance[5] << std::endl; //12 ``` ### 多维数组 ``` int a[2][3] = {{1, 2, 3,}, {3, 4, 5}}; ``` ## 字符串 ### char 初始化 ``` char asd[] ="hello"; ``` ### 使用 string ``` #include <string> string demo = "hello word"; cout << demo << endl; ``` 常用函数 ``` s.empty() //空 返回 true s.size() //返回字符串个数 s[n] //返回第几个字符,从 0 开始 s1+s2 //字符串拼接 ```