Write a C++ Program for Cricket Match
/*A criket team has the following table of batting figures for a
series of test matches:
-----------------------------------------------------------------
Player's Name Runs Innings Times not out
-----------------------------------------------------------------
venkat 632 15 0
prasanna 514 14 3
Gavaskar 675 17 2
. . . .
. . . .
------------------------------------------------------------------
Write a program to read the figures set out in the above form, to calculate
the batting averages and to print out the complete table including the averages.*/
#include
#include
#include
void main()
{
void line();
void star();
int runs,innings;
float avg;
cout<<"\nEnter 5 records including following details\n";
cout<<"1) Player's Name\n";
cout<<"2) Runs\n";
cout<<"3) Innings\n";
cout<<"4) Times Not out\n\n";
struct cricketer
{
char name[15];
int runs;
int innings;
int tno;
float avg;
}rec[5];
for(int i=0;i<5;i++)
{
cout<<"\nEnter Player Name:-";
cin>>rec[i].name;
cout<<"Enter Runs:-";
cin>>rec[i].runs;
cout<<"Enter Innings:-";
cin>>rec[i].innings;
cout<<"Enter Time not out:-";
cin>>rec[i].tno;
rec[i].avg = float(rec[i].runs)/rec[i].innings;
}
clrscr();
cout<<"\n\n\n";
cout<
cout<
for(int i=0;i<5;i++)
{
cout<
line();
cout<
cout<
getch();
}
//======================line=====================\\
void line()
{
for(int i=1;i<41;i++)
cout<<"--";
cout<<"\n";
}
//======================star======================\\
void star()
{
for(int i=1;i<41;i++)
cout<<"**";
cout<<"\n";
}