Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have posted the 2 links that are part of the question at the bottom. Each picture is a continuation of the previous one. http://en.wikipedia.org/wiki/Associative_containers
I have posted the 2 links that are part of the question at the bottom. Each picture is a continuation of the previous one.
http://en.wikipedia.org/wiki/Associative_containers
http://www.cplusplus.com/reference/map/map/map/
Part2 Design and implement a C/C++ program to read a file, to do the following tasks Task1 Read the file and print the output for each line. The "passwd1.txt" file has its account information as shown below. Each 1ine represents one account record as we have studied for (1) user name [userid (2) password (3) uid (4) gid (5) GECOS field (general comment field, (6) pathname for user's home directory, and (70 user's default shell. Each field is separated by colon cat passw dl.txt SYSTEM: :18:544 1-5-18 Local Service: 19:54 4:U-NT AUTHORITYLocalService, S-1-5-19 Network Service 20:544:U-NT AUTHORITY Network Service, S-1-5-20 Administrators 544:544 S-1-5-32-544 Administrator: richard-P Guest: 501:513:U richard-P /home/Guest: /bin/bash richard: 1000:51 Professor:home/richard:/bin bash 13:CS john: :1010:600:John- Staff tho /bin/sh. mejohn: For each line (record), the program will print the following output. For example, userid: richard uid: 1000 gid: 513 gecos: CS Professor home directory: /home/richard shell /bin/bash Task #2. Design and implement two C++ static variables useridMap 1 and useridMap2 each is an associative map, to keep track of the reference of each user-account object so that you may enumerate (terate each object. 1) The first map keeps track of the pair ofuserid and uid. (2) The second map keeps track of the pair of userid and gid. (3) Print the content of each map, Ca sorted by uid (uid-userid pair and (b) sorted by gid (gid- userid pairStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started