📜  遍历地图 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:50.806000             🧑  作者: Mango

代码示例1
int arr[] = { 1, 1, 2, 1,  3, 1, 4, 3 };
map m;
for (auto i: arr)
    m[arr[i]]++;
cout << "Element  Frequency" << endl;
for (auto& [k,v] : m) // Since c++17
    cout << k << "   " << v << endl;