1:数组中存储的数据也可以是string类型的。代码如下:

// 6.22.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

int main(int argc, _TCHAR* argv[])
{
    string sArrary[5] = {"明日","科技","","","服务!!"};
    string s="";   //空的string
    for(int i = 0;i<5;i++)
    {
        s+=sArrary[i];
    }
    cout<<s<<endl;
    
    return 0;
}
View Code

相关文章: