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

C++ PROGRAM assignment . 1) Write one line of code for each line below. What is

ID: 3844661 • Letter: C

Question

C++ PROGRAM assignment

. 1) Write one line of code for each line below. What is the template type in each case?

a- Create a vector to store student IDs

b- Create a vector to store student names

c- Create a vector to store Point2D points

d- Create a set to store unique (no duplicates) student names

e- Create a set to store unique (no duplicates) student IDs

f- Create a map that maps student IDs to their score

g- Create a map that maps student IDs to their name

h- Create a map that maps student names to the name of their lab partner

Explanation / Answer

a. std::vector<int> stud_id;

b. std::vector<std::string> stud_name;

c. struct Point2D;
std::vector<Point2D> point;

d. std::set<std::string> setOfNames; setOfNames.insert("first"); //set insert unique names

e. std::set<int> studid; studid.insert(1211); //set insert unique id values

f. map<int,float> result; result.insert(make_pair(1211,8.5));
(or)
map<int,float> m{{1,7.0f} , {2,6.5f} , {3,9.0f} };

g. map<int,string> student;
(or)
map<int,string> m{ {1,”andrena”} , {2,”john”} , {3,”steve”} };

h. map<string,string> labpatner;
(or)
map<string,string> labpatner{ {"john","smith"}, {"andrena","james"},{"steve","robert"} };

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote