0
3.5kviews
Define a structure cricket which consist following members

(i) player name

(ii) country name

(iii) batting average

Input 20 player information of test playing country, Write a program which will display detail informati.on of player with given player name.


1 Answer
0
277views
#include iostream.h
#include conio.h
#include string.h
struct cricket
{
 char name[20], country[20];
 float avg;
};
void main()
{
 cricket c[20];
 char search[20]

 for (i=0;i<20;i++)
 {
 printf("\n Enter name, country and average \n");
 scanf("%s,%s,%f",&c[i].name,&c[i].country,&c[i].avg);
 }
 printf("Enter the name of the player to search details.\n")
 scanf("%s",&search);
 for (i=0;i<20;i++)
 {
 if(strcmp(search,c[i].name)==0)
  {
   printf("Player %s from %s has an average of %f ", search,c[i].country,c[i].avg);
  }
 else
 printf("not found");
 getche();
}
Please log in to add an answer.