Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the declaration for a map that associatesvalues of type long int with valu

ID: 3615080 • 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

//second part. //Hope this will help you. if we will do it by indexed array, then we will need more size ofarray depend upon the maximum ssn number. if maximum ssn is 10000, then we will need to have 10000 array sizewhich is not the case of map.