📜  无序映射 c++ 代码示例

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

代码示例1
// C++ program to demonstrate functionality of unordered_map
#include 
#include 
using namespace std;
 
int main()
{
    // Declaring umap to be of  type
    // key will be of string type and mapped value will
    // be of int type
    unordered_map umap;
 
    // inserting values by using [] operator
    umap["GeeksforGeeks"] = 10;
    umap["Practice"] = 20;
    umap["Contribute"] = 30;
 
    // Traversing an unordered map
    for (auto x : umap)
      cout << x.first << " " << x.second << endl;
 
}