Your Ad Here

Thursday, July 5, 2007

Structures

/* Program To Display The Highest Salary Of A Employees */

int count;
struct employee
{
int idno,salary;
char name[10];
};

struct employee s[10];

void main()
{
int i,loc=0;
float top;
clrscr();
printf("Enter Number Of Employees : ");
scanf("%d",&count);
for(i=0;itop)
{
top=s[i].salary;
loc=i;
}

}
printf("\nThe Highest Salary Is : ");
printf("%s",s[loc].name);
getch();
}
/***************** OUTPUT ******************

Name : Lionel
ID no : 40
salary : 25000

Name : Cyril
ID no : 42
salary : 10000

Name : Bob
ID no : 46
salary : 15000

Name : Nigel
ID no : 45
salary : 12000
___________________________
Name ID no. Salary
---------------------------------------
Lionel 40 25000
Cyril 42 10000
Bob 46 15000
Nigel 45 12000
---------------------------------------
The Highest Salary Is : Lionel */

No comments:

Your Ad Here