/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <unordered_map>
#include <string>
int main() {
// 創建一個無序映射,將字符串映射到整數
std::unordered_map<std::string, int> umap;
// 插入一些鍵值對
umap["apple"] = 10;
umap["banana"] = 20;
umap["cherry"] = 30;
// 使用迭代器遍歷映射並打印每個鍵值對
for (const auto& pair : umap) {
std::cout << pair.first << ": " << pair.second << std::endl;
}
return 0;
}