fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. unordered_map<string, int> myMap;
  6. myMap["ratul"] = 2;
  7. myMap["apple"] = 1;
  8. myMap["cherry"] = 10;
  9.  
  10. for(const auto& pair : myMap) {
  11. cout << pair.first << " " << pair.second << std::endl;
  12. }
  13. return 0;
  14. }
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
cherry 3
banana 2
apple 1