C++
08 Jan 2010
 
 
 
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#include "stdafx.h"
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <list>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
list <int> iList;
ifstream infile("iter.dat");
istream_iterator <int> file_iter(infile);
istream_iterator <int> end_of_stream;
copy(file_iter,end_of_stream, back_inserter(iList));
cout<<endl;
ostream_iterator <int> ositer (cout,"--");
copy(iList.begin(), iList.end(),ositer);
cout<<endl;
return 0;
}