#include <iostream>
using namespace std;
class player
{
public :
char name [50],gender[10];
int w,h;
};
class details :public player
{
public :
details ()
{
cout <<"Player name : ";
cin >>name;
cout <<name <<endl;
cout <<"Gender : ";
cin >>gender;
cout <<gender <<endl;
cout <<"Weight : ";
cin>>w;
cout<<w<<" kg"<<endl;
cout <<"Height : ";
cin>>h;
cout <<h<<" cm"<<endl;
}
};
class sports
{
public :
char spo[20],cl[20];
int med,dl,sl,nl;
void spo_det()
{
cout<<"Sport name : ";
cin >>spo;
cout <<spo<<endl;
cout <<"category level : ";
cin>>cl;
cout <<cl<<endl;
cout <<"won medals : ";
cin>>med;
cout <<med<<endl;
}
};
class tournaments :public sports, public details
{
public :
void tour_det()
{
cout <<"District level tournaments : ";
cin >>dl;
cout <<dl<<endl;
cout <<"State level tournaments : ";
cin >>sl;
cout <<sl<<endl;
cout <<"National level tournaments : ";
cin >>nl;
cout <<nl<<endl;
cout <<"Total tournaments played : "<<dl+sl+nl<<endl;
}
};
int main() {
tournaments obj;
obj. spo_det();
obj. tour_det();
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: