#include <iostream>
#include <fstream>
#include <vector>
#include <iterator>
using namespace std;
int main( int argc, char **argv )
{
vector<int> v;
ifstream in("1.txt");
if (in) {
copy(istream_iterator<int>(in), istream_iterator<int>(), back_inserter(v));
copy(v.begin(), v.end(), ostream_iterator<int>(cout, " "));
/*
for (int i = 0; i < v.size(); i++) {
cout << v[i] << " ";
}
*/
}
return 0;
}
from:
http://bbs.chinaunix.net/viewthread.php?tid=1218395
posted on 2010-02-25 08:58
chatler 阅读(600)
评论(0) 编辑 收藏 引用 所属分类:
C++_BASIS