#include <iostream>
using namespace std;
class student
{
public:
int roll_no,mark_1,mark_2;
void get()
{
cin>>roll_no;
cin>>mark_1;
cin>>mark_2;
}
};
class sports
{public:
int sport_mark;
void getsm()
{
cin>>sport_mark;
}
};
class statement:public student,public sports
{
public:
int total,average;
void display()
{
total=mark_1+mark_2+sport_mark;
average=(mark_1+mark_2+sport_mark)/3;
cout<<roll_no<<endl;
cout<<total<<endl;
cout<<average;
}
};
int main()
{
statement obj;
obj.get();
obj.getsm();
obj.display();
return 0;
}
using namespace std;
class student
{
public:
int roll_no,mark_1,mark_2;
void get()
{
cin>>roll_no;
cin>>mark_1;
cin>>mark_2;
}
};
class sports
{public:
int sport_mark;
void getsm()
{
cin>>sport_mark;
}
};
class statement:public student,public sports
{
public:
int total,average;
void display()
{
total=mark_1+mark_2+sport_mark;
average=(mark_1+mark_2+sport_mark)/3;
cout<<roll_no<<endl;
cout<<total<<endl;
cout<<average;
}
};
int main()
{
statement obj;
obj.get();
obj.getsm();
obj.display();
return 0;
}
No comments:
Post a Comment