You are on page 1of 2

#include<iostream>

using namespace std;


class Player {
private:
int sn;
int tr;
int ts;
int df;
int Shirtno;
int totalruns;
int totalseason;
int deliveryfaced;
public:
Player(int sn,int tr,int ts, int df) {
Shirtno = sn;
totalruns = tr;
totalseason = ts;
deliveryfaced = df;
}
void setshirtno() {
Shirtno = sn;
}
void settotalruns() {
totalruns = tr;
}
void settotalseason() {
totalseason = ts;
}
void setdeliveryfaced() {
deliveryfaced = df;
}

void getshirtno() {
cout << "Enter the shirt no of the player:" << endl;
cin >> sn;

}
void gettotalruns() {
while (1) {
cout << "Enter the total runs of the player:" << endl;
cin >> tr;
if (tr <= 4000) {
break;
}
else {
cout << "ERROR:" << endl;
continue;
}
}
}
void gettotalseason() {
while (1) {
cout << "Enter the total season of the player:" << endl;
cin >> tr;
if (ts <=10) {
break;
}
else {
cout << "ERROR:" << endl;
continue;
}
}
}
void getdeliveryfaced() {
while (1) {
cout << "Enter the delivery faced of the player:" << endl;
cin >> df;
if (df <=60) {
break;
}
else {
cout << "ERROR:" << endl;
continue;
}
}
}
void average(int average) {
average = (tr / ts);
cout << "The average of player is :" << average;
}

};
int main() {
int sn{};
int tr{};
int ts{};
int df{};
int average{};
Player p1{sn,tr,ts,df};
p1.getshirtno();
p1.gettotalruns();
p1.gettotalseason();
p1.getdeliveryfaced();
cout << "The detail of the player 2 is:" << endl;
Player p2{ sn,tr,ts,df };
p2.getshirtno();
p2.gettotalruns();
p2.gettotalseason();
p2.getdeliveryfaced();
Player p3{ sn,tr,ts,df };
p3.getshirtno();
p3.gettotalruns();
p3.gettotalseason();
p3.getdeliveryfaced();

Player p4{ sn,tr,ts,df };


p4.getshirtno();
p4.gettotalruns();
p4.gettotalseason();
p4.getdeliveryfaced();

Player p5{ sn,tr,ts,df };


p5.getshirtno();
p5.gettotalruns();
p5.gettotalseason();
p5.getdeliveryfaced();

You might also like