-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcricketers info.cpp
More file actions
54 lines (49 loc) · 1.76 KB
/
cricketers info.cpp
File metadata and controls
54 lines (49 loc) · 1.76 KB
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
48
49
50
51
52
53
54
#include<iostream>
using namespace std;
int n;
class cricketer
{
public:
string name;
int runs;
float avg;
void print ()
{
cout<<"___________________________________________________"<<endl;
cout<<endl;
cout<<"|||"<<" "<<name<<" "<<"||"<<" "<<runs<<" "<<"||"<<" "<<avg<<" "<<"|||";
}
};
int main()
{
cout<<"PLEASE ENTER NUMBER OF CRICKETERS YOU WANT TO ENTER:";
cin>>n;
cricketer* cricketers = new cricketer[n];
for(int i=0;i<n;++i)
{ cout<<"______________________________________________________________________"<<endl;
cout<<"PLEASE ENTER THE CRICKETER Number "<<i+1<<" NAME :--"<<endl;
cout<<"Name:";
cin.ignore();
getline(cin,cricketers[i].name);
cout<<endl;
cout<<"PLEASE ENTER THE CRICKETER Number "<<i+1<<" TOTAL SCORE :--"<<endl;
cout<<"RUNS:";
cin>>cricketers[i].runs;
cout<<endl;
cout<<"PLEASE ENTER THE CRICKETER Number "<<i+1<<" AVERAGE :--"<<endl;
cout<<"AVERAGE:";
cin>>cricketers[i].avg;
}
cout<<"________________________________________________________________________________________________________________________\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<" DISPLAYING CRICKETER'S DATA"<<endl;
cout<<endl;
cout<<"_____________________________________________________________________________________________________________________"<<endl;
cout<<"||| NAME || RUNS || AVERAGE |||"<<endl;
for(int i=0;i<n;++i)
{
cricketers[i].print();
cout<<endl;
}
delete[]cricketers;
return 0;
}