/* This shows how to look at the return value of insert in a set (a map is similar) */ #include #include using namespace std; int main() { string s; set names; set ::iterator nit; pair ::iterator, bool> retval; while(getline(cin, s)) { retval = names.insert(s); if (retval.second) { cout << s << ": Successfully inserted.\n"; } else { cout << s << ": Duplicate not inserted.\n"; } } return 0; }