Question: Given the following struct definition. struct Employee { string name; string id; string dept; int performance Rating;//1,2,3,4 double salary; }; Write a C++ program to
Given the following struct definition. struct Employee { string name; string id; string dept; int performance Rating;//1,2,3,4 double salary; };
Write a C++ program to do the following: i. Write the definition of function calTotalSalary(Employee[]). The function receives an array of employees, calculates and returns the total salary.
ii. Read the file named employee.txt and store the records into an array of struct variables named emp. There are 50 employee records in the file. The record consists of the employee name, employee id, department, performance rating and salary. employee.txt
iii. Select and write the information of employees from the Marketing and Human Resource into separate file output named marketing.txt and humanResource.txt respectively. Refer sample output files below.
iv. Select and display the information of employees from the Marketing department whose performance rating is 4.
v. Find and display the total salary. Call appropriate function. marketing.txt humanResource.txt

- . employeeABC - Notepad File Edit Format View Help ali;1111; finance; 4;3500 siti;2222; marketing;4;3200 sarah; 6666;marketing;3;2500 azam; 1234; human resource; 3;2800 shah;3452; security;2;2000 employee.txt marketing - Notepad File Edit Format View Help List of Marketing Employees siti 2222 marketing 4 3200 sarah 6666 marketing 3 2500 marketing.txt human Resource - Notepad File Edit Format View Help List of Human Resource Employees azam 1234 human resource 3 2800 humanResource.txt
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
