/****************************/
/* 連想配列 */
/* coded by Y.Suganuma */
/****************************/
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main()
{
// 生成
unordered_map<string, int> x ({{"aaa", 10}, {"ddd", 20}, {"ccc", 30}});
for (auto y : x)
cout << y.first << ":" << y.second << " ";
cout << endl;
// 参照
cout << " キー ccc に対する値: " << x["ccc"] << endl;
// 追加
x.emplace("bbb", 1);
cout << " キー bbb に対する値 1 を追加: ";
for (auto y : x)
cout << y.first << ":" << y.second << " ";
cout << endl;
// 削除
x.erase("aaa");
cout << " キー aaa に対する値を削除: ";
for (auto y : x)
cout << y.first << ":" << y.second << " ";
cout << endl;
return 0;
}