// 假设有三个班次:早班(0),中班(1),晚班(2)
int schedule[7][3]; // schedule[day][shift]存储员工ID
void basic_schedule(Employee *employees, int employee_count) {
for(int day = 0; day < 7; day++) {
for(int shift = 0; shift < 3; shift++) {
int selected_employee_id = -1;
// 遍历员工,寻找合适的员工
for(int i = 0; i < employee_count; i++) {
if(employees[i].availability[day] == 1) {
selected_employee_id = employees[i].id;
break; // 找到一个可用的员工就退出循环
}
}
schedule[day][shift] = selected_employee_id;
}
}
}
利唐i人事HR社区,发布者:hi_ihr,转转请注明出处:https://www.ihr360.com/hrnews/20241225790.html