Question
A company keeps the database of its employees in a text file. The format of the file is FirstName LastName Salary ID Define a structure
A company keeps the database of its employees in a text file. The format of the file is FirstName LastName Salary ID Define a structure called Employee with appropriate member variables to store the four parameters. In your main function, declare an STL list to store the data in the file. Read the file, one line of data at a time and store it in the list. Design functions for the following purposes 1. Removing any entry by ID specified by the user This function needs to accept the ID of an employee, search the list for the ID and then erase that entry. 2. List the data of the employees with the last name starting with a character provided by the user This function needs to accept a character, search if the last name of an employee starts from the specified character and display that entry if it does so. From your main function, call your designed functions with appropriate arguments to demonstrate their user. Use the provided file HW5Prob3.dat to solve this problem. For example, if my I have the following function calls in my main function removebyID(l1,254785); listbyLastName(l1,'s');
HW5Prob3.dat:
John Harris 50000.00 113785 Lisa Smith 75000.487 254785 Adam Johnson 68500.10 321258 Sheila Smith 150000.50 165478 Tristen Major 75800.76 102596 Yannic Lennart 58000.55 369854 Lorena Emil 43000.00 225478 Tereza Santeri 48000.001 136478
You should get the following output:
Sheila Smith 150000 165478
Tereza Santeri 48000 136478
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