Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- using namespace std;
- int main()
- {
- map<string, int> godini;
- godini["Josif"] = 24;
- godini["Jakov"] = 14;
- godini["Petar"] = 17;
- godini["Ognen"] = 14;
- cout << godini["Josif"] << endl;
- for(map<string, int>::iterator it = godini.begin(); it != godini.end(); it++) {
- cout << it->first << " " << it->second << endl;
- }
- cout << endl;
- for(pair<string, int> p: godini) {
- cout << p.first << " " << p.second << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment