#include
#include
typedef struct //typedef
{
char name[20];
char surname[20];
int salary;
}employee;
void getdata(employee em[])//keep in array[]
{
int i;
for(i=0;i<5;i++){
printf("Name [%d] : ",i+1);
gets(em[i].name);
printf("surname : ");
gets(em[i].surname);
printf("salary : ");
flushall();
scanf("%d",&em[i].salary);
flushall();
}
}
void printmax(employee em[]) // printf
{
int i,max;
int temp;
max=em[0].salary;
for(i=0;i<5;i++){
if(em[i].salary>max){
max=em[i].salary;
temp=i;
}
}
printf("Employee [%d] have max salary",temp+1);
printf("Name : %s \n",em[temp].name);
printf("Surname : %s \n",em[temp].surname);
printf("Salary : %d",max);
}
void main()
{
clrscr();
employee x[5];
getdata(x);
printmax(x);
getch();
}