#include #include using namespace std; int main(){ map animal_weights; animal_weights["cat"] = 8.2; animal_weights["cow"] = 1300; // User entry here cout << "Enter more animals!\n"; cout << "Type of Animal: "; string animal_type; cin >> animal_type; /* This part wasn't in the video, because I forgot to put it there * .count can tell you how many times something is in the dictionary * It'll be 0 or 1, but if it's 1, that means the item is already there */ if(animal_weights.count(animal_type)) cout << animal_type << " was already in the list\n"; cout << "weight: "; float w; cin >> w; animal_weights[animal_type] = w; for(auto a : animal_weights) cout << a.first << " " << a.second << endl; return 0; }