Problem

a. Write the declaration for a map that associates values of type long int with values of...

a. Write the declaration for a map that associates values of type long int with values of type string. The long int will be the key (index), and the string will be its associated data. You can imagine this data structure as holding Social Security numbers (SSNs) and names.

b. Write a simple driver that inputs ten SSNs, with corresponding names, and stores them in the map declared in part (a). It should then allow the user to input an SSN, after which the matching name is output. Be sure that you handle cases of SSNs that aren’t in the map.

c. Given the use of the map in part (b), explain why it is a better choice of data structure than an array indexed by the SSN.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT