Untitled
unknown
plain_text
a year ago
856 B
0
Indexable
Never
#include <string> #include <iostream> using namespace std; struct Employee { string name; int accessLevel; double salary; int contractDuration; }; void calculateTotalSalary(Employee* employees, int size, double* totalSalaries) { for (int i = 0; i < size; i++) { totalSalaries[i] = employees[i].salary * employees[i].contractDuration; } } int main() { int N; N = 3; Employee* employees = new Employee[N]; employees[0] = { "John", 10, 5000, 12, }; employees[1] = { "Anna", 8, 4000, 6 }; employees[2] = { "Peter", 6, 3000, 3 }; double* totalSalaries = new double[N]; calculateTotalSalary(employees, N, totalSalaries); for (int i = 0; i < N; i++) { cout << "Employee " << employees[i].name << ", total salary: " << totalSalaries[i] << endl; } }