Advertisement
apl-mhd

Mouka mOukaDemo

Nov 4th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.15 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. /*
  8.  * File:   main.cpp
  9.  * Author: antimatter
  10.  *
  11.  * Created on November 4, 2016, 9:23 PM
  12.  */
  13.  
  14. #include <cstdlib>
  15. #include <cstdio>
  16. #include <string>
  17.  
  18. using namespace std;
  19.  
  20. struct  player{
  21.  
  22.     char name[50];
  23.     char country[50];
  24.     int runs[3];
  25.     int wickets[3];
  26.     int points[3];
  27.  
  28. };
  29.  
  30. void playrsDetails(struct player playerIndex[50]){
  31.  
  32.  
  33.     int i,j, mofMathc=0, index;
  34.  
  35.      for(i = 0; i<2; i++){
  36.  
  37.         printf("Player's Name: ");
  38.        // gets(playerIndex[i].name);
  39.         scanf("%s", &playerIndex[i].name);
  40.         //getchar();
  41.  
  42.         printf("\nPlayer's Country: ");
  43.         scanf("%s", &playerIndex[i].country);
  44.        // gets(playerIndex[i].country);
  45.           //getchar();
  46.         printf("\n");
  47.  
  48.         /*Run Input section */
  49.  
  50.         for(j=0; j<3; j++){
  51.             printf("%d match run:",j+1);
  52.             scanf("%d", &playerIndex[i].runs[j]);
  53.  
  54.             if(playerIndex[i].runs[j]<25){
  55.                  playerIndex[i].points[j] = 0 ;
  56.             }
  57.  
  58.             if(playerIndex[i].runs[j]>=25 && playerIndex[i].runs[j]<50 ){
  59.                  playerIndex[i].points[j] = 5 ;
  60.             }
  61.              if(playerIndex[i].runs[j]>=50 && playerIndex[i].runs[j]<75 ){
  62.                  playerIndex[i].points[j] = 10;
  63.             }
  64.             if(playerIndex[i].runs[j]>=75 && playerIndex[i].runs[j]<100 ){
  65.                  playerIndex[i].points[j] = 15 ;
  66.             }
  67.  
  68.              if(playerIndex[i].runs[j]>=100){
  69.                  playerIndex[i].points[j] = 20 ;
  70.             }
  71.  
  72.  
  73.  
  74.         }
  75.           printf("\n");
  76.  
  77.           /*****************wickets input***********************/
  78.           /*_____________________________________________________*/
  79.  
  80.          for(j=0; j<3; j++){
  81.             printf("%d match wickets:",j+1);
  82.             scanf("%d", &playerIndex[i].wickets[j]);
  83.  
  84.             if(playerIndex[i].wickets[j] > 0){
  85.                 playerIndex[i].points[j] += playerIndex[i].wickets[j]*12  ;
  86.             }
  87.  
  88.         }
  89.  
  90.           printf("\n\n\n");
  91.  
  92.     }
  93.  
  94. }
  95.  /**********man of the mathc and series****************/
  96. void mofMathcAndSeries(struct player playerIndex[50]){
  97.  
  98.   int i, j, mofMathc,mofSeries=0, index;
  99.  
  100.   for(i=0; i<3; i++){
  101.  
  102.       mofMathc =0;
  103.       for(j=0; j<2; j++){
  104.  
  105.           if(playerIndex[j].points[i] > mofMathc){
  106.  
  107.               mofMathc = playerIndex[j].points[i];
  108.  
  109.               index =j;
  110.  
  111.           }
  112.  
  113.           printf("-------------%d mathc-----\nman oft the mathc: %s \n", i+1, playerIndex[index].name);
  114.           printf(" Total Points:%d \n\n", playerIndex[index].points[i]);
  115.  
  116.       }
  117.   }
  118.  
  119.  
  120.  
  121.  
  122.  
  123. }
  124.  
  125.  
  126.  
  127. /*
  128.  *
  129.  */
  130. int main(int argc, char** argv) {
  131.       int i,j;
  132.     struct player playerIndex[50];
  133.  
  134.     playrsDetails(playerIndex);
  135.  
  136.     mofMathcAndSeries(playerIndex);
  137.  
  138.  
  139.  
  140. //    for(i =0; i<1; i++){
  141.  
  142. //        for(j =0; j<3; j++){
  143.  
  144. //             printf("%d match point = %d\n",j+1, playerIndex[i].points[j]);
  145. //        }
  146.  
  147. //    }
  148.  
  149.     return 0;
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement