-
Notifications
You must be signed in to change notification settings - Fork 15
/
Exer11_14.cpp
36 lines (36 loc) · 859 Bytes
/
Exer11_14.cpp
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
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <utility>
#include <iterator>
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::vector;
using std::map;
using std::pair;
using std::ostream_iterator;
int main()
{
map<string, vector<pair<string, string>>> family;
string patronymic;
string child_name, child_birthday;
ostream_iterator<string> os(cout, " ");
while(cin >> patronymic)
{
while(cin >> child_name >> child_birthday)
{
family[patronymic].push_back(make_pair(child_name, child_birthday));
}
cin.clear(); // clear for next input
}
for(const auto &w : family)
{
cout << w.first << ":\n";
for(const auto &c : w.second)
cout << c.first << " " << c.second << endl;
}
return 0;
}