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;
}

 

posted @ 2012-03-27 11:44  幻星宇  阅读(196)  评论(0编辑  收藏  举报