{"id":5584,"date":"2026-05-06T15:17:55","date_gmt":"2026-05-06T06:17:55","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=5584"},"modified":"2026-05-06T15:21:32","modified_gmt":"2026-05-06T06:21:32","slug":"basicmap-using-map","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2026\/05\/06\/basicmap-using-map\/","title":{"rendered":"[Basic]map\uc0ac\uc6a9\ud558\uae30\/Using map"},"content":{"rendered":"\n<p>\ud83d\udc49\ud83c\udffb  C++\uc5d0\uc11c \ub9f5\uc744 \uc0ac\uc6a9\ud558\ub294 \ubc29\ubc95\uc5d0 \ub300\ud55c \uc124\uba85\uc785\ub2c8\ub2e4.<br>This is an explanation of how to use Maps in C++.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \ud0a4\uc640 \uac12 \ud615\ud0dc\ub85c \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\uace0 find()\ud568\uc218\ub85c \uac12\uc73c \ucc3e\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>You can store data in key-value format and find values \u200b\u200busing the find() function.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \ucf54\ub4dc \/ Code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\n#include &lt;map>\n#include &lt;string>\n\nint main() {\n\n    \/\/ std::map \uc120\uc5b8: \ub3c4\uc2dc \uc774\ub984 -> \ub3c4\uc2dc \uc124\uba85\n    \/\/ \ud0a4\ub294 std::string, \uac12\ub3c4 std::string\n    \/\/ std::map declaration: City Name -> City Description\n    \/\/ Keys are std::strings, values \u200b\u200bare also std::strings\n    std::map&lt;std::string, std::string> route_map;\n\n    \/\/ \ub370\uc774\ud130 \uc0bd\uc785 \/ Insert data\n    route_map&#91;\"Seoul\"] = \"Capital of South Korea\";\n    route_map&#91;\"Busan\"] = \"Famous port city\";\n    route_map&#91;\"Jeju\"] = \"Popular island tourist destination\";\n\n    \/\/ \ub9f5 \ub0b4\uc6a9\uc744 \ucd9c\ub825 \/ Print map contents\n    for (const auto&amp; pair : route_map) {\n        std::cout &lt;&lt; pair.first &lt;&lt; \": \" &lt;&lt; pair.second &lt;&lt; std::endl;\n    }\n\n    \/\/ \ud2b9\uc815 \ud0a4 \uac80\uc0c9 \uc608\uc81c \/ Specific key search example\n    std::string city = \"Seoul\";\n    auto iter = route_map.find(city);\n    if (iter != route_map.end()) {\n        std::cout &lt;&lt; city &lt;&lt; \" \uc815\ubcf4\/info.: \" &lt;&lt; iter->second &lt;&lt; std::endl;\n    } else {\n        std::cout &lt;&lt; city &lt;&lt; \" \uc815\ubcf4\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \/ Can not find information\" &lt;&lt; std::endl;\n    }\n\n    return 0;\n}\n<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \ucef4\ud30c\uc77c \/ Compiling<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>g++ main.cpp -o main -std=c++17<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f\uc2e4\ud589 \/ Run<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/main<\/code><\/pre>\n\n\n\n<p> \u2714\ufe0f \uacb0\uacfc \/ Result<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MacBookAir map % .\/main                         \nBusan: Famous port city\nJeju: Popular island tourist destination\nSeoul: Capital of South Korea\nSeoul \uc815\ubcf4\/info.: Capital of South Korea\n<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc49\ud83c\udffb C++\uc5d0\uc11c \ub9f5\uc744 \uc0ac\uc6a9\ud558\ub294 \ubc29\ubc95\uc5d0 \ub300\ud55c \uc124\uba85\uc785\ub2c8\ub2e4.This is an explanation of how to use Maps in C++. \ud83d\udc49\ud83c\udffb \ud0a4\uc640 \uac12 \ud615\ud0dc\ub85c \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\uace0 find()\ud568\uc218\ub85c \uac12\uc73c \ucc3e\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.You can store data in key-value format and find values \u200b\u200busing the find() function. \ud83d\udc49\ud83c\udffb \ucf54\ub4dc \/ Code \u2714\ufe0f \ucef4\ud30c\uc77c \/ Compiling \u2714\ufe0f\uc2e4\ud589 \/ Run \u2714\ufe0f \uacb0\uacfc \/ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,1],"tags":[],"class_list":["post-5584","post","type-post","status-publish","format-standard","hentry","category-cpp","category-uncategorized","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=5584"}],"version-history":[{"count":6,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5584\/revisions"}],"predecessor-version":[{"id":5590,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5584\/revisions\/5590"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=5584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=5584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=5584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}