Josif_tepe

Untitled

Oct 8th, 2025
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     map<string, int> godini;
  8.    
  9.     godini["Josif"] = 24;
  10.     godini["Jakov"] = 14;
  11.     godini["Petar"] = 17;
  12.     godini["Ognen"] = 14;
  13.    
  14.     cout << godini["Josif"] << endl;
  15.    
  16.     for(map<string, int>::iterator it = godini.begin(); it != godini.end(); it++) {
  17.         cout << it->first << " " << it->second << endl;
  18.     }
  19.    
  20.     cout << endl;
  21.    
  22.     for(pair<string, int> p: godini) {
  23.         cout << p.first << " " << p.second << endl;
  24.     }
  25.    
  26.     return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment