-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCRICTABL.CPP
More file actions
47 lines (46 loc) · 895 Bytes
/
CRICTABL.CPP
File metadata and controls
47 lines (46 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
struct cric
{
char name[15];
float avg;
int inn;
int nt;
int run;
};
int main()
{
struct cric *p;
int n,i;
clrscr();
cout<<"\n How many players' info ?\n";
cin>>n;
p=new struct cric [n];
for(i=0;i<n;i++)
{
cout<<"\n Enter name,runs,innings,no. of times not out of player "<<(i+1)<<endl;
cin>>(((p+i))->name);
cin>>((p+i)->run);
cin>>((p+i)->inn);
cin>>((p+i)->nt);
}
for(i=0;i<n;i++)
{
((p+i)->avg)=(float)((p+i)->run)/(((p+i)->inn)-((p+i)->nt));
}
cout<<"\nDetails of "<<n<<" players\n\n";
cout<<"NAME\t\tRUNS\t\tINNINGS\t\tTIMES NOT OUT\t\tAVERAGE\n";
for(i=0;i<n;i++)
{
cout<<endl<<setw(-8)<<((p+i)->name);
cout<<setw(14)<<((p+i)->run);
cout<<setw(16)<<((p+i)->inn);
cout<<setw(20)<<((p+i)->nt);
cout<<setw(24)<<setprecision(4)<<((p+i)->avg);
}
delete []p;
p='\0';
getch();
return 0;
}