Write the declaration for a map that associatesvalues of type long int with valu
ID: 3615039 • Letter: W
Question
Write the declaration for a map that associatesvalues of type long int with values of typestring. The long int willbe the key (index), and the string will be itsassociated data. You can imagine this data structure asholding Social Security numbers and names.Now write a simple driver that inputs ten SSN's with correspondingnames, and stores them in the map declaredabove. It should then allow the user to input an SSN, afterwhich the matching name is output. Be sure that you handlecases of SSN's that arent in the map.
Given the use of the map in the second part,explain why it is a better choice of data structure than an arrayindexed by SSN.
Explanation / Answer
//first part, hope this will help you. #include #include using namespace std; int main() { map freqs; long int c;string s; int i,n=10; for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.