📝 Map
- 특징
- ('키', '값')의 쌍을 원소로 저장하는 제네릭 컨테이너
- '키'로 '값'을 검색
- 많은 응용에서 필요함
- #include <<"map">>필요

#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
map<string, string> dic;
dic.insert(make_pair("love", "사랑"));
dic.insert(make_pair("apple", "사과"));
dic["cherry"] = "체리";
cout << "사전의 단어 갯수" << dic.size() << endl;
string eng;
while (true)
{
cout << "찾고 싶은 단어>>";
getline(cin, eng);
if (eng == "exit") { break; }
if (dic.find(eng) == dic.end())
cout << "없음" << endl;
else
cout << dic[eng] << endl;
}
cout << "종료합니다..";
}