#include <stdio.h>
#include <string.h>
struct player{
char name[20];
char country[20];
int run[2];
int wicket[2];
int point[2];
};
int main()
{
int n,points=0;
int mom1=0,mos=0,mom2=0;
char *mom_n1,*mos_n,*mom_n2;
printf("Enter total number of players played in the tournament: ");
scanf("%d",&n);
struct player p[n];
printf("Enter Information of %d Players\n",n);
for(int x=0;x<n;x++){
printf("Information of %d Player\n",x+1);
printf("Enter Name: ");
scanf(" %s",p[x].name);
printf("Enter country: ");
scanf("%s",p[x].country);
printf("Enter Runs of 2 Matches: ");
for(int i=0;i<2;i++)
scanf("%d",&p[x].run[i]);
printf("Enter number of Wickets in 2 Matches: ");
for(int i=0;i<2;i++)
scanf("%d",&p[x].wicket[i]);
printf("Enter points of 2 Matches: ");
for(int i=0;i<2;i++)
scanf("%d",&p[x].point[i]);
printf("***************************************\n");
}
for(int i=0;i<n;i++){
points = 0;
if(50 >p[i].run[0] && p[i].run[0] >= 25)
points += 5;
else
if(75 >p[i].run[0] && p[i].run[0] >= 50)
points += 10;
else
if(100 >p[i].run[0] && p[i].run[0] >= 75)
points += 15;
else
points += 20;
points += p[i].wicket[0]*12;
if(points > mom1){
mom1 = points;
mom_n1 = p[i].name;
}
points = 0;
if(50 >p[i].run[0] && p[i].run[1] >= 25)
points += 5;
else
if(75 >p[i].run[0] && p[i].run[1] >= 50)
points += 10;
else
if(100 >p[i].run[0] && p[i].run[1] >= 75)
points += 15;
else
points += 20;
points += p[i].wicket[1]*12;
if(points > mom2){
mom2 = points;
mom_n2 = p[i].name;
}
points = 0;
for(int j=0;j<2;j++){
if(50 >p[i].run[0] && p[i].run[j] >= 25)
points += 5;
else
if(75 >p[i].run[0] && p[i].run[j] >= 50)
points += 10;
else
if(100 >p[i].run[0] && p[i].run[j] >= 75)
points += 15;
else
points += 20;
points += p[i].wicket[j]*12;
}
if(points > mos){
mos = points;
mos_n = p[i].name;
}
}
printf("Man of the Match1: %s with points: %d\n",mom_n1,mom1);
printf("Man of the Match2: %s with points: %d\n",mom_n2,mom2);
printf("Man of the Series: %s with points: %d\n",mos_n,mos);
return 0;
}
Comments
Leave a comment