#include #include #include //for class string #include //for class vector #include //for class map using namespace std; int main() { map> m { {"Honda", {"Red", "Blue", "Black"}}, {"Toyota", {"White", "Silver", "Green"}} }; string carModel; cout << "What is the model of the car (Honda or Toyota)?\n"; cin >> carModel; if (!cin) { cerr << "Sorry, could not receive input.\n"; return EXIT_FAILURE; } cout << "The available colors for the " << carModel << " are:\n"; auto it {m.find(carModel)}; if (it == m.end()) { //Couldn't find the model. cerr << "Sorry, that wasn't a valid car model.\n" << "Please enter 'Honda' or 'Toyota'.\n"; return EXIT_FAILURE; } auto v {it->second}; //Get the vector of 3 colors for this model. for (int i {0}; i < v.size(); ++i) { cout << i+1 << ". " << v[i] << "\n"; } return EXIT_SUCCESS; }