Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include <iostream> #include <map> using namespace std; int main() { map<string, int> people = { {"John", 32}, {"Adele", 45}, {"Bo", 29} }; // Remove an element by key people.erase("John"); // This will throw an error as John no longer exists cout << "John is: " << people.at("John") << "\n"; return 0; }
terminate called after throwing an instance of 'std::out_of_range'
what(): map::at