#include #include //for setw #include #include #include //for class map using namespace std; int main() { map m { {"Kallax", "shelf unit"}, {"Ekenabben", "open shelf unit"}, {"Ivar", "2 section shelving unit"}, {"Skruvby", "sideboard"}, {"Besta", "storage combination with doors"}, {"Holmerud", "slide table"}, {"Skarpo", "armchair, outdoor"}, {"Revskar", "3-seat combination set"}, {"Nammaro", "3-seat modular sofa, outdoor"}, {"Billy", "bookcase"} }; cout << "The map contains " << m.size() << " pairs:\n\n"; for (const auto& pair: m) { cout << setw(9) << left << pair.first << " = " << pair.second << "\n"; } for (;;) { cout << "\n"; cout << "Please type an IKEA word, or control-d to quit: "; string ik; cin >> ik; if (!cin) { break; //The user typed control-d } cout << ik << " means " << m[ik] << ".\n"; //m.operator[](ik) } return EXIT_SUCCESS; }