1234567891011121314151617181920
#include<iostream> #include<fstream> #include<iterator> #include<algorithm> #include<list> using namespace std; int main() { list<int> foo; ifstream infile("c:\\a.txt"); istream_iterator<int> in(infile); copy(in,istream_iterator<int>(),front_inserter(foo)); copy(foo.begin(),foo.end(),ostream_iterator<int>(cout," ")); cout<<endl; system("pause"); }
foo