-
Notifications
You must be signed in to change notification settings - Fork 0
/
11.2.3.cc
38 lines (30 loc) · 840 Bytes
/
11.2.3.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <utility>
#include <vector>
#include <string>
#include <iterator>
#include <fstream>
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
vector<pair<string, int> > pvec;
ifstream fsin("infiles");
ifstream fiin("infilei");
istream_iterator<string> sin(fsin);
istream_iterator<int> iin(fiin);
istream_iterator<string> seof;
istream_iterator<int> ieof;
ostream_iterator<string> sout(cout, " ");
ostream_iterator<int> iout(cout, " ");
while(sin != seof && iin != ieof){
// pvec.push_back(std::pair<string, int>(*sin++, *iin++));
// pvec.push_back(make_pair(*sin++, *iin++));
pvec.push_back({*sin++, *iin++});
}
for(auto & p : pvec){
sout = p.first;
iout = p.second;
sout = "\n";
}
return 0;
}