Question: You are given the following declarations and code fragment: class Person { public: }; string name; string jobTitle; int salary; int sum; list personList;
You are given the following declarations and code fragment: class Person { public: }; string name; string jobTitle; int salary; int sum; list personList; list ::iterator lit; map personMap; map ::iterator mit; lit = personList.begin(); mit = personMap.find("brad"); In answering the following two questions, syntax is everything. I expect you to use the *... and -> operators correctly in accessing the values of all objects involved in your answers. 1. Write a printf statement that prints the contents of the Person to which lit points. The person's name and jobtitle should be left-justified in fields of width 20 and the salary should be printed in a field of width 6. I do not care whether or not you put spaces between the fields. 2. Write a statement that assigns to sum the value of the salary of the Person to which mit points.
Step by Step Solution
There are 3 Steps involved in it
1 To print the contents of the Person object to which l... View full answer
Get step-by-step solutions from verified subject matter experts
