/* THIS CODE HAS BEEN TESTED AND IS FULLY OPERATIONAL. Problem Statement: Write a program in C++ to use map associative container. The keys will be the names of states, and the values will be the populations of the states. When the program runs, the user is prompted to type the name of a state. The program then looks in the map, using the state name as an index, and returns the population of the state. Code from Object Oriented Programming (SPPU - Second Year - Computer Engineering - Content) repository on KSKA Git: https://git.kska.io/sppu-se-comp-content/ObjectOrientedProgramming */ // BEGINNING OF CODE #include #include #include // THIS IS NOT NEEDED FOR NEWER C++ COMPILER, BUT SINCE COLLEGES USE OLD STUFF, HAD TO INCLUDE using namespace std; map m1; // Creating an associative container (map) with string as key (state name) and int as value (state population) int total; // Store total number of states void addState() { string key; int value; cout<>key; cout<<"State population:\t"; cin>>value; m1.insert({key, value}); cout<<"--- STATE SAVED ---"<>key; auto p = m1.find(key); // auto automatically determines the datatype (i.e. int, float, etc.) if (p == m1.end()) { cout<first<<"] with population of ["<second<<"] deleted.\n"; m1.erase(p); } } void displayState() { string key; cout<>key; auto p = m1.find(key); cout<first<<"] has a population of:\t ["<second<<"]"<::iterator p; p = m1.begin(); while (p != m1.end()) { cout<first; // first = first value, i.e. key (state name) cout<second; // second = second value, i.e. value (state population) cout< Add states"; cout< Delete state"; cout< Search for a state"; cout< Display all states"; cout< Exit"; cout<>optn; switch (optn) { case 1: cout<>total; addState(); break; case 2: delState(); break; case 3: displayState(); break; case 4: displayAll(); break; case 5: cout<