A map of word opposites, using strings. #include #include #include using namespace std; int main() { map mapObject; int i; mapObject.insert(pair("yes", "no")); mapObject.insert(pair("up", "down")); mapObject.insert(pair("left", "right")); mapObject.insert(pair("good", "bad")); string s; cout << "Enter word: "; cin >> s; map::iterator p; p = mapObject.find(s); if(p != mapObject.end()) cout << "Opposite: " << p->second; else cout << "Word not in map.\n"; return 0; }