int main(){ string names[4]={"张三","李四","王五"}; //cout<<*(names+2)<<endl; vector<string> vtName; cout<<vtName.size()<<endl; vtName.push_back("张三"); //迭代器 for(vector<string>::iterator it=vtName.begin();it!=vtName.end();++it){ cout<<*it<<endl; } int ia[ 6 ] = { -2, -1, 0, 1, 2, 1024 }; vector< int > ivec( ia, ia+6 ); cout<<ivec[5]<<endl;//输出1024 cout<<ivec.at(2)<<endl; array<string,5> strArray; strArray.fill("默认内容"); cout<<strArray[1]<<endl; strArray[1]="你好地球"; cout<<strArray[1]<<endl; system("pause"); return 0; }
基本使用。