Code:
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#include<time.h>
using namespace std;
class Bowler{//******************************class bowler***********************
    int overs,povers,maidovers,runsgiv,wictaken;
    public:
        void disp()
        {
            cout<<"\n\t   BOWLER\n";
            cout<<"\novers played       : "<<povers;
            cout<<"\nmaiden overs       : "<<maidovers;
            cout<<"\nruns given         : "<<runsgiv;
            cout<<"\nwickets taken      : "<<wictaken;
        }
        int giv(char *choose)
        {
            if(choose=="overs")
            {
                return(overs);
            }
            else if(choose=="maidovers")
            {
                return(maidovers);
            }
            else if(choose=="runsgiv")
            {
                return(runsgiv);
            }
            else if(choose=="wictaken")
            {
                return(wictaken);
            }
        }
        void over()
        {
            cout<<"enter number of overs : ";
            cin>>overs;
        }
        void update(int run,int iout,int j,int balls[])
        {
            int l=0,m;
            if(j==5)
            {
                povers++;
                for(m=0;m<6;m++)
                {
                    if(balls[m]==0)
                        l++;
                }
            }
            if(l==6)
            {
                maidovers++;
                for(m=0;m<6;m++)
                {
                    balls[m]=1;
                }
            }
            if(run!=5)
                runsgiv=run;
            else
                runsgiv=0;
            if(!iout)
            {
                wictaken++;
            }
        }
}ball;

class Batsman{//********************class Batsman*******************************
    int runs,iout,run,mod;
    char name[10],*mout;
    static int count;
    public:
        Batsman()
        {
            iout=1;
        }
        void updatecount()
        {
            count++;
        }
        int giv(char *choose)
        {
            if(choose=="iout")
            {
                return(iout);
            }
            else if(choose=="runs")
            {
                return(runs);
            }
            else if(choose=="run")
            {
                return(run);
            }
        }
        void init(int &a)
        {
            system("cls");
            if(a!=0)
            {
                cout<<"the batsman #"<<count-1<<" is out now out\n";
            }
            cout<<"enter name of batsman #"<<count<<" : ";
            cin>>name;
            iout++;
            runs=0;
        }
        void disp()
        {
            cout<<"\n\t   BATSMAN #"<<count<<"\n";
            cout<<"\nName               : "<<name;
            cout<<"\nruns made          : "<<runs;
            cout<<"\nstatus             : ";
            switch(mod)
            {
                case 0:mout="Catch out";break;
                case 1:mout="Run-out";break;
                case 2:mout="Wicket";break;
                case 3:mout="Bold";break;
                case 4:mout="Hit-Wicket";break;
            }
            if(!iout)
            {
                cout<<"Out\n";
                cout<<"mode by which out  : "<<mout;
            }
            else if(iout)
            {
                cout<<"Not out";
            }
        }
        void update()
        {
            srand(time(NULL));
            run=rand()%7;
            if(run==5)
            {
                iout--;
                mod=rand()%5;
            }
            else
            {
                runs+=run;
            }
        }
}bats[10];

int Batsman :: count=1;

int main()
{
    ball.over();
    system("cls");
    char *ch;
    int ov,i=0,balls[6],j,l=0,z=1,k;
    bats[i].init(i);
    cout<<"the score board is ready to be used\n";
    getch();
    system("cls");
    ov=(ball.giv("overs"));
    for(k=0;k<ov;k++)
    {
        if(l)
        {
            break;
        }
        for(j=0;j<6;j++)
        {
            balls[j]=bats[i].giv("run");
            bats[i].update();
            ball.update(bats[i].giv("run"),bats[i].giv("iout"),j,balls);
            if(k+1==1)
            {
                ch="st";
            }
            else if(k+1==2)
            {    
                ch="nd";
            }
            else if(k+1==3)
            {
                ch="rd";
            }
            else
            {
                ch="th";
            }
            if(j==6)
            {
                system("cls");
                cout<<"the "<<k+1<<ch<<" over is finished";
                cout<<"\n";
            }
            bats[i].disp();
            ball.disp();
            cout<<"\n\nnow the bowler throws the ball...\n";
            cout<<"press enter to update the score board...";
            getch();
            system("cls");
            if(!bats[i].giv("iout"))
            {
                if(i<10)
                {
                    i++;
                }
                else if (i>10)
                {
                    l++;
                    j=7;
                    break;
                }
                bats[i].updatecount();
                bats[i].init(i);
            }
        }//end of loop of balls
    }//end of loop of overs
    system("cls");
    if(k==ov)
    {
        cout<<"overs finished";
    }
    else if(l)
    {
        cout<<"all batsmen out !";
    }    
    cout<<"\nend result :-";
    bats[i].disp();
    ball.disp();
getch();
return 0;
}//end of main()