Experiment No 13
Experiment No 13
13
Aim: Write a C program to declare a structure to store the information of 10 cricketers having
the following field
a. Cricketer name
b. Match played
c. Runs scored
d. Strike rate
Use a function to display the cricketer information having the maximum strike rate
void main()
{
int i,j,n;
printf("Enter the no of cricket players\n");
scanf("%d",&n);
printf("Enter player info as name , wickets taken , runs scored\n");
for(i=0;i<n;i++)
{
scanf("%s %d %d",player[i].name,&player[i].wickets,&player[i].runs);
}
for(i=0;i<n;i++)
{
for(j=0;j<n-1;j++)
{
if(player[j].runs>player[j+1].runs)
{
t=player[j];
player[j]=player[j+1];
player[j+1]=t;
}
}
}
for(i=0;i<n;i++)
{
printf("%s\t\t\t%d\t\t\t%d\n",player[i].name,player[i].wickets,player[i].runs);
}
}
Conclusion : After successful execution of this experiment structure is studied well also
understood how to list structure members, by this experiment po 1,3,5,8,9,12 are achieved.