Define a structure called cricket that will describe the following information player name,team name, batting rating. Using cricket , declare an array player with 10 elements and write a program  to read the information about all the 10 players and print a team wise list containing names of players with their batting rating

 source file name: CricketInfo.C

#include<string.h>

struct Cricket

{

char player_name[20];

char team_name[10];

int bat_rating;

};

void main()

{

int i,n;

char tname[15];

struct Cricket players[]={

{"Rohit Sharma","Ind",825},{"Virat Kohali","Ind",857},

{"David Warner","Aus",773},{"Aron Finch","Aus",791},

{"Babar Azam","Pak",865},{"Fakhar Zaman","Pak",778},

{"Quinton Decook","SA",756},{"Faf Du Plessis","SA",778},

{"Kane Willamson","NZ",754},{"Ross Taylor","NZ",801}};

clrscr();

printf("\n Player's  list: ");

for(i=0;i<10;i++)

{

printf("\n%s\t%s\t%d ",players[i].player_name,players[i].team_name,players[i].bat_rating);

}

printf("\n select Country name from Ind,Aus,Pak,SA,NZ:\n ");

gets(tname);

for(i=0;i<10;i++)

{

n=strcmpi(players[i].team_name,tname);

if(n==0)

printf("\n%s\t%d ",players[i].player_name,players[i].bat_rating);

}

getch();

}

output: