#include "Utils.hpp" #include #include #include using namespace std; int main(int argc, char **argv) { unordered_map dictionary = {}; cout << "dictionary size: " << dictionary.size() << endl; cout << "dictionary is " << (dictionary.empty() ? "empty" : "not empty") << endl; dictionary["apple"] = "red"; dictionary["banana"] = "yellow"; dictionary["cantaloupe"] = "orange"; dictionary["dragonfruit"] = "red"; dictionary["elderberry"] = "purple"; cout << "dictionary size: " << dictionary.size() << endl; cout << "dictionary is " << (dictionary.empty() ? "empty" : "not empty") << endl; cout << "bananas are " << dictionary.at("banana") << endl; string x = "dragonfruit"; if (dictionary.count(x)) { cout << x << " are " << dictionary.at(x) << endl; } else { cout << "Can't find " << x << endl; } x = "fig"; if (dictionary.count(x)) { cout << x << " are " << dictionary.at(x) << endl; } else { cout << "Can't find " << x << endl; } x = "elderberry"; dictionary.erase(x); if (dictionary.count(x)) { cout << x << " are " << dictionary.at(x) << endl; } else { cout << "Can't find " << x << endl; } cout << Utils::to_string(dictionary) << endl; return 0; }