65,211
社区成员
发帖
与我相关
我的任务
分享
string str[]={"hello","world!"};
#include <iostream>
#include <string>
using namespace std;
int main()
{
string arrStr[3];
arrStr[0] = "aaaaa";
arrStr[1] = "bbbbb";
arrStr[2] = "ccccc";
for(int i=0; i<3; i++)
cout << arrStr[i] << endl;
cin.get();
return 0;
}
// 字符串
char str[128];
strcpy(str, "hello world");
//字符串数组
char str_arry[4][128];
strcpy(str_arry[0], "hello world 0");
strcpy(str_arry[1], "hello world 1");
strcpy(str_arry[2], "hello world 2");
strcpy(str_arry[3], "hello world 3");