fork(17) download
  1. #include <iostream>
  2. #include <unordered_map>
  3. using namespace std;
  4.  
  5. int main() {
  6. unordered_map<string,double> mapA = {{"sugar",0.1},{"salt",0.2}};
  7. unordered_map<string,double> mapB = {{"sugar",0.3},{"pepper",0.4}};
  8. mapA.insert(mapB.begin(), mapB.end());
  9. for (auto &i : mapA) {
  10. cout << i.first << " " << i.second << endl;
  11. }
  12. return 0;
  13. }
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
pepper 0.4
salt 0.2
sugar 0.1