Question: unordered _ map abbreviations = { { LOL , laughing out loud } , { IDK , I don't know }

unordered_map abbreviations ={
{"LOL", "laughing out loud"},
{"IDK", "I don't know"},
{"BFF", "best friends forever"},
{"IMHO","in my humble opinion"},
{"TMI", "too much information"}
};
string input;
cout << "Enter an abbreviation: ";
getline(cin, input);
// Convert input to uppercase for case-insensitive matching
transform(input.begin(), input.end(), input.begin(), ::toupper);
// Check if abbreviation exists in the map
if (abbreviations.count(input)>0){
cout << abbreviations[input]<< endl;
} else {
cout << "Unknown" << endl;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!