Advertisement
apl-mhd

sadu

Nov 4th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.89 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. struct players
  4. {
  5.     char name[50];
  6.     char country[50];
  7.     int run[3];
  8.     int wickets[3];
  9.     int points[3];
  10. };
  11.  
  12. void players_detials(struct players players_index[50])
  13.  
  14. {
  15.     int i,j,points,n,r,p,w,wp,k,rsum=0,wsum=0,match;
  16.  
  17.     //int rarr[3],warr[3],total[100];
  18.  
  19.      printf("Total matches played: ");
  20.  
  21.      scanf("%d",&match);
  22.  
  23.     for(k=0; k<3; k++)
  24.     {
  25.         for(i=0; j<22; j++)
  26.         {
  27.             printf("d.Enter name of players: \n",i+1);
  28.             scanf("%s", players_index[k].name);
  29.             printf("Enter country of players %d: \n",i+1);
  30.             scanf("%s", players_index[k].country);
  31.  
  32.             printf("\nMatch: %d Runs: ",k+1);
  33.  
  34.             scanf("%d",&r);
  35.  
  36.             n=r/25;
  37.  
  38.             p=1;
  39.  
  40.             // for(i=0; i<=n; i++)
  41.  
  42.             if(j=25*i)
  43.             {
  44.                 points=5*p;
  45.                 p++;
  46.             }
  47.             else
  48.                 points=0;
  49.  
  50.             //}
  51.  
  52.             printf("Points made for runs: %d\n",points);
  53.  
  54.             players_index[k].run[i]=points;
  55.  
  56.             rsum+=players_index[k].run[i];
  57.  
  58.             // for(i=0; i<=3; i++)
  59.  
  60.             printf("\nMatch: %d Wickets: ",i+1);
  61.  
  62.             if(players_index[i].wickets[j] > 0)
  63.             {
  64.                 players_index[i].points[j] += players_index[i].wickets[j]*12;
  65.             }
  66.  
  67.             printf("\nPoints made for wickets: %d\n",wp);
  68.  
  69.             players_index[k].wickets[i]=wp;
  70.  
  71.             wsum+=players_index[k].wickets[i];
  72.  
  73.             players_index[k].points[k]=rsum+wsum;
  74.         }
  75.  
  76.  
  77.  
  78.     }
  79.     printf("\nSum of all the points of runs in 3 matches are: %d\n",rsum);
  80.     printf("\nSum of all the points of wickets in 3 matches are: %d\n",wsum);
  81.     printf("\nTotal points in 3 matches: %d\n",players_index[k].points[k]);
  82.  
  83. }
  84.  
  85.  
  86. int main(int argc, char** argv)
  87. {
  88.     int i,j;
  89.     struct players players_index[50];
  90.  
  91.     players_detials(players_index);/**********************/
  92.    // players_details(players_index);
  93.  
  94.     //Man_of_the_Match_Series(players_index);
  95.  
  96.    int mom=0,mos=0, index;
  97.  
  98.     for(i=0; i<3; i++)
  99.     {
  100.         for(j=0; j<2; j++)
  101.         {
  102.  
  103.             if(players_index[i].points[j] > mom)
  104.             {
  105.  
  106.                 mom = players_index[j].points[i];
  107.  
  108.                 index =j;
  109.  
  110.             }
  111.  
  112.             printf("---%d.Match-----\nMan of the Match: %s \n", i+1, players_index[index].name);
  113.             printf(" Total Points:%d \n\n", players_index[index].points[i]);
  114.         }
  115.     }
  116.  
  117.     for(i=0; i<22; i++)
  118.     {
  119.         int total_point=0;
  120.         for(j=0; j<3; j++)
  121.         {
  122.             total_point=total_point+players_index[j].points[i];
  123.  
  124.         }
  125.         if(total_point>mos)
  126.         {
  127.             mos=total_point;
  128.  
  129.         }
  130.  
  131.     }
  132.     printf("%s is MAN of the Series his total point is %d\n",players_index[i].name,mos);
  133.  
  134.  
  135.  
  136.     return 0;
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement