Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a) Using the input file students.txt, build a C++ map (or unordered_map) that has a vector of all students in every course as the
a) Using the input file students.txt, build a C++ map (or unordered_map) that has a vector of all students in every course as the value with the course name as the key. Your code must work for any size file and any other courses that may exist, CSC382 for example. You may assume each line in the input file two string. The first is the course identified followed by a first name. Make your code general enough so any number of students can be listed in any course. students.txt Math 141 Joe CSC335 Chris Math141 Chris CSC335 Kim Eng101 Kim CSC335 Devon Eng101 Devon b) Also, write the C++ code to generate the following output with the given small file above. Output the key, followed by a colon ":", followed by the first names in the vector separated by blank spaces. CSC335: Chris Kim Devon Eng101: Kim Devon Math 141: Joe Chris
Step 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