Advertisement
Guest User

my map

a guest
Dec 18th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include<cstring>
  2. #include <iostream>
  3. #include <map>
  4. using namespace std;
  5. int main() {
  6.     std::map<string, int> mp;
  7.     int d = 0;
  8.     string name;
  9.     string a, b, c;
  10.     while (cin) {
  11.         cin >> a >> b >> c;
  12.         name = a + " " + b + " " + c;
  13.         cin >> d;
  14.         mp[name, d] += d;
  15.         if (!cin)
  16.             break;
  17.     }
  18.     for (auto i = mp.begin(); i != mp.end(); ++i) {
  19.         cout << i -> first << " " << i -> second << endl;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement