You are viewing a single comment's thread. Return to all comments →
this my Cpp solution
int main() { map< string, int> phonebook; int T; cin >> T; string name, findname; int number;
for (int i; i<T; i++){ cin >> name; cin >> number; phonebook[name]=number; } while ( cin >> findname){ if (phonebook.find(findname) != phonebook.end()) { cout << findname << "=" << phonebook[findname]<< std::endl; } else { cout << "Not found" << std::endl; } } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Day 8: Dictionaries and Maps
You are viewing a single comment's thread. Return to all comments →
this my Cpp solution
int main() { map< string, int> phonebook; int T; cin >> T; string name, findname; int number;
}