#include #include #include using namespace std; int main() { map gradebook; gradebook["Albert"] = 99; gradebook["Bonnie"] = 172; gradebook["Christopher"] = 85; cout << "The original size of the map is " << gradebook.size() << endl; gradebook.erase(gradebook.find("Christopher")); cout << "After erasing Christopher, the size of the map is " << gradebook.size() << endl; gradebook.insert(pair("Buck", 12)); if (!gradebook.empty()) { cout << "After inserting Buck, the size of the map is " << gradebook.size() << endl; } string name = "Bonnie"; if (gradebook.find(name) != gradebook.end()) { cout << name << "'s grade is " << gradebook[name] << endl; } else { cout << name << " was not found" << endl; } // print all elements for (map::iterator it = gradebook.begin(); it != gradebook.end(); it++) { cout << "name: " << it->first << " " << "grade: " << it->second << endl; } gradebook.clear(); cout << "After calling clear, the size of the map is " << gradebook.size() << endl; return 0; }