This is the program question:
Make a program, using the function below, that displays the highest salary of each department in a company and how many employees earn the highest salary in the department. For each department, the program should read the department code and the number of employees, and for each employee, enrollment and salary. Completion of departments reading: department code = 0. Make the function a_ department to process the employees of a department. This function should receive as a parameter the number of employees of the department, read the data of each find the department's highest salary and how many employees earn this salary, storing them in the variables whose addresses are given in the function call.
I've made the following code:
#include <stdio.h>
struct funcionario
{
char nome[20];
float salario;
char matricula[10];
};
void um_departamento(struct funcionario *func, int *numfunc){
int i, maior,cont=0;
maior = func[0].salario;;
for (i = 0; i < *numfunc; i++){
if (func[i].salario > maior){
maior = func[i].salario;
cont++;
}
}
printf("%d %d", maior,cont);
}
int main(){
int departamento, i, functot, coddep, depzin,num=20;
struct funcionario funz[num];
printf ("Digite o departamento e seu codigo");
scanf ("%d %d", &departamento, &coddep);
for (i = 0; i < departamento; i++){
dep (functot);
print ("Digite a matricula e o salário");
scanf ("%f%f", &funz[i].salario, &funz[i].matricula);
}
um_departamento(funz, &num);
return 0;
}
How can I fix it? Thank you in advance.