Hackerrank | 30 days of code | Day 8-Solution in c++| Dictionaries-and-Maps-hackerrank-Solution-in-c++
https://www.hackerrank.com/challenges/30-conditional-statements/problem
Day 8 Distionaries and Maps Solution in Cpp#include <iostream> #include <map> using namespace std; int main() { int N; string name; cin >> N; mapphone_book; for (int i = 0; i < N; i++) { cin >> name; if (!phone_book[name]) { cin >> phone_book[name]; } } while (cin>>name) { if (phone_book[name]) { cout << name << "=" << phone_book[name] << endl; } else { cout << "Not found" << endl; } } return 0; }
0 Comments