title: Program on cricket scoreboard
body: <p>Why is the following code not giving results and how to get results?</p>
  
  <p>Whenever I run the code, it first asks for the names of the players of two teams playing the match, then it shows the menu from which if we select any one of the option it again asks for the batsman name which is not according to the program designed. My research on the code and the problem is that I think buffer memory is full but I don't know how to free it, any help would be beneficial. Thank you</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;string.h&gt;
  #include&lt;conio.h&gt;
  using namespace std;
  class scorecard{
  char batname[11][20];
  int runscored[11];
  char situation[11][10];
  char mode[11][15];
  char bowlername[11][20];
  float oversplayed[11];
  int maiden[11];
  int runsgiven[11];
  int wicketstaken[11];
  public:
  
  void updatebatsman(void);
  void updatebowler(void);
  void displaybat(void);
  void displaybowl(void);
  void menu(void);
  scorecard()
  {for(int n=0;n&lt;12;n++)
     {
  
      runscored[n]={0};
       oversplayed[n]={0};
   maiden[n]={0};
   runsgiven[n]={0};
   wicketstaken[n]={0};
     }
  }
  
  
  
  
  };
  int main()
  {
      int jb=0;
       scorecard s1;
      int kb;
      s1.menu();
      do
      {
       cout&lt;&lt; "Enter the option"&lt;&lt;endl;
          cout&lt;&lt;"(1) Display batting score"&lt;&lt;endl&lt;&lt;"(2) Display Bowling score"&lt;&lt;endl&lt;&lt;"(3) Update batting score"&lt;&lt;endl;
          cout&lt;&lt;"(4) Update Bowling score"&lt;&lt;endl;
  
          cin &gt;&gt;kb;
          switch(kb)
          {
              case 1 : s1.displaybat();
                      break;
              case 2 :s1.displaybowl();break;
              case 3:s1.updatebatsman();break;
              case 4:s1.updatebowler();break;
              default:cout&lt;&lt;"Wrong choice";
          }
      }while (jb&lt;1);
  }
  
  void scorecard::updatebowler(void)
      {char bowlname[20];
      int str,k,option,overnumbers,maidenumb,uprun,upwicket;
          cout&lt;&lt;"Enter Bowler name:";
          cin.getline(bowlname,20);
      for( k=0;k&lt;11;k++)
        {str=  strcmp(bowlername[k],bowlname);
        if (str== 0)
        {
            cout&lt;&lt;"Menu for Bowler information update "&lt;&lt;endl;
            cout&lt;&lt;"(1) Update Number of overs"&lt;&lt;endl&lt;&lt;"(2) Update maiden overs"&lt;&lt;endl&lt;&lt;"(3) Update runs given"&lt;&lt;endl;
            cout&lt;&lt;"(4) Update wickets taken"&lt;&lt;endl;
            cin &gt;&gt; option;
            switch(option)
            {
                case 1:{cout&lt;&lt;"Enter Numbers of overs to be updated:";
                        cin &gt;&gt;overnumbers;
                        cout&lt;&lt;endl;
                        oversplayed[k]+=overnumbers;
                        break;
                       }
                 case 2:{cout &lt;&lt;"Enter the number of maiden overs to be updated:";
                         cin&gt;&gt;maidenumb;
                         cout&lt;&lt;endl;
                         maiden[k]+=maidenumb;
                         break;
                        }
                 case 3:{cout &lt;&lt;"Enter the number of runs to be added:";
                         cin&gt;&gt;uprun;
                         cout&lt;&lt;endl;
                         runsgiven[k]+=uprun;
                         break;
  
                        }
                  case 4: {cout&lt;&lt;"Enter number of wickets to be updated:";
                           cin &gt;&gt;upwicket;
                           cout&lt;&lt;endl;
                           wicketstaken[k]+=upwicket;
                          }
                     default:cout&lt;&lt;"wroung choice";
  
            }
            break;
        }
  
  
  
        }
        if (str!=0)
          cout &lt;&lt;"You entered wrong player."&lt;&lt;endl;
  
      }
  
  
  
       void scorecard::updatebatsman(void)
      {char batsmaname[20];
      int str,k;
          cout&lt;&lt;"Enter Batsman name:";
          cin.getline(batsmaname,20);
      for( k=0;k&lt;11;k++)
        {str=  strcmp(batname[k],batsmaname);
        if (str== 0)
        {
            cout&lt;&lt;"enter runs scored:";
            cin&gt;&gt;runscored[k];
  
            cout&lt;&lt;endl&lt;&lt;"enter weather out or not out:";
            cin&gt;&gt;situation[k];
            cout&lt;&lt;endl&lt;&lt;"enter mode(if batsman out) by which batsman was out:";
            cin&gt;&gt;mode[k];
            break;
        }
  
  
  
        }
        if (str!=0)
          cout &lt;&lt;"You entered wrong player."&lt;&lt;endl;
  
      }
  void scorecard::displaybat(void)
  {
      cout &lt;&lt; "Batsman name"&lt;&lt;'t'&lt;&lt;"Runs scored"&lt;&lt;'t'&lt;&lt;"situation"&lt;&lt;'t'&lt;&lt;"mode"&lt;&lt;endl;
  
      for(int j=0;j++;j&lt;12)
      {
          cout&lt;&lt;batname[j]&lt;&lt;'t'&lt;&lt;runscored[j]&lt;&lt;'t'&lt;&lt;situation[j]&lt;&lt;'t'&lt;&lt;mode[j]&lt;&lt;endl;
      }
  }
  void scorecard::displaybowl(void)
  {
       cout &lt;&lt; "Bowler name"&lt;&lt;'t'&lt;&lt;"overs played"&lt;&lt;'t'&lt;&lt;"maiden overs"&lt;&lt;'t'&lt;&lt;"wicket taken"&lt;&lt;'t'&lt;&lt;"Runs given"&lt;&lt;endl;
      cout&lt;&lt;endl;
      for(int j=0;j++;j&lt;12)
      {
          cout&lt;&lt;bowlername[j]&lt;&lt;'t'&lt;&lt;oversplayed[j]&lt;&lt;'t'&lt;&lt;maiden[j]&lt;&lt;'t'&lt;&lt;wicketstaken[j]&lt;&lt;'t'&lt;&lt;runsgiven[j]&lt;&lt;endl;
      }
  }
  void scorecard::menu(void)
  
  {
      cout&lt;&lt;"Enter the name of players of batting team"&lt;&lt;endl;
      for (int k=0;k&lt;11;k++)
      {
  
          cout &lt;&lt;"Enter name of player "&lt;&lt;k+1&lt;&lt;":";
      cin&gt;&gt;batname[k];
      }
      cout &lt;&lt;"Enter the name of players of bowling team"&lt;&lt;endl;
      for (int n=0;n&lt;11;n++)
      {
  
          cout &lt;&lt;"Enter name of player "&lt;&lt;n+1&lt;&lt;":";
      cin&gt;&gt;bowlername[n];
      }
  }
  </code></pre>