1. 字符串指针数组
const char *cities[5]={"beijing","shanghai","nanjing","suzhou","wuxi"};
cout<<cities[0]<<endl;
cout<<cities[1]<<endl;
.....
cout<<cities[4]<<endl;
//可以像输出普通数组一样直接以下标的形式输出指针数组中的各个元素
可以像输出普通数组一样直接以下标的形式输出指针数组中的各个元素
2. 二维数组
char cities[5][25]={"beijing","shanghai","nanjing","suzhou","wuxi"};
3. 使用string对象数组
const string cities[5]={"beijing","shanghai","nanjing","suzhou","wuxi"};
cout<<cities[0]<<endl;
cout<<cities[1]<<endl;
.....
cout<<cities[4]<<endl;