#include<iostream>
using namespace std;
class student
{ 
	int rno;
	char name[20];
	public: 
	void getstu()
	{
		cout << "Enter stuid, name";
		cin >> rno >> name;
	}
};

class marks: public student
{
	protected: 
	int m1, m2, m3;
	public:
	void getmarks(){
		cout << "Enter 3 subject marks:";
		cin >> m1 >> m2 >> m3;
	}
};

class sports
{
	protected:
	int spmarks;
	public:
	void getsports(){
		cout << "Enter sports marks:";
		cin >> spmarks;
	}
};

class result : public marks, public sports
{
	int tot;
	float avg;
	public :
	void show()
	{
		tot=m1+m2+m3;
		avg=tot/3.0;
		cout << "Total=" << tot << endl;
		cout << "Average=" << avg << endl;
		cout << "Average + Sports marks =" << avg+spmarks;
	}
};

int main()
{
	result r;
	r.getstu();
	r.getmarks();
	r.getsports();
	r.show();
}


     
           
Note: Need to be arranged in compiler after copied
   

 OutPut:

Enter stuid, name
1
sri
Enter 3 subject marks:
75
80
79
Enter sports marks:50
Total=164
Average=54.6667
Average + Sports marks =104.667