vector的一个简单实例

// vector.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <vector>

int main(int argc, char* argv[])
{
/*string word;
vector<string> text;
int i = 0;
while( cin>>word ){
text.push_back(word);
cout << text[i] << endl;
i++;
}*/
vector<int> ivec;
for( vector<int>::size_type ix = 0; ix != 10; ++ix ){
ivec.push_back(ix);
}
for(int i = 0; i < ivec.size(); i++ ){
cout<< ivec[i] << endl;
}
return 0;
}

原文地址:https://www.cnblogs.com/xingmeng/p/2419293.html