#include #include #include #include using namespace std; int main() { vector names { "New York", "Yonkers", "Hastings", "Dobbs Ferry", "Irvington", "Tarrytown" }; vector population { 8478072, //New York 211569, //Yonkers 9289, //Hastings 11541, //Dobbs Ferry 6653, //Irvington 11860 //Tarrytown }; const size_t n {names.size()}; for (;;) { cout << "Type a city (or control-d to quit): "; string name; getline(cin, name); if (!cin) { break; //The user typed control-d } for (int i {0}; i < n; ++i) { if (name == names[i]) { cout << name << " " << population[i] << "\n"; break; } } } return EXIT_SUCCESS; }