title: Top Scoring Batsman Name - C++
body: <p><strong>Top Scoring Batsman Name - C++</strong></p>
  
  <p>The runs scored by N batsmen of a cricket team is passed as the input to the program. The program must print the name of the batsman who scored the highest runs. (You can assume that no two batsmen will be the top scorers)</p>
  
  <pre><code>#include &lt;bits/stdc++.h&gt;
  
  using namespace std;
  
  int main(int argc, char** argv)
  {
  //Defines no of batsmen
  int n;
  cin&gt;&gt;n;
  //Define names of batsmen and their runs
  string s[100];
  int r[100];
  //Getting inputs
  for(int i=0;i&lt;n;i++){
  scanf("%s,%d",&amp;s[i],&amp;r[i]);
  }
  // //Assign a value to int max variable
  int max=r[0];
  int location=0;
  //find max value
  for(int i=1;i&lt;n;i++){
  if(r[i] &gt; max){
      max = r[i];
      location = i;
  }
  }
  cout&lt;&lt;s[location];
  }
  </code></pre>
  
  <p>Input Format: The first line denotes the value of N. Next N lines will contain the name of the batsman and the runs score (both separated by a comma)  .</p>
  
  <p>Output Format: The first line contains the name of the batsman with the top score. </p>
  
  <p>Example Input/Output 1:  </p>
  
  <pre><code>Input: 
  5 
  BatsmanA,45 
  BatsmanB,52 
  BatsmanC,12 
  BatsmanD,9 
  BatsmanE,78  
  
  Output: BatsmanE
  </code></pre>