Untitled
plain_text
a month ago
771 B
1
Indexable
Never
#include<iostream> using namespace std; class student { protected: int rno,m1,m2; public: void get() { cout<<"Enter the Roll no:"; cin>>rno; cout<<"Enter the two marks:"; cin>>m1>>m2; } }; class sports { protected: int sportmarks; public: void getsm() { cout<<"\nENter the sports mark:"; cin>>sportmarks; } }; class statement:public student,public sports { int tot,avg; public: void display() { tot=(m1+m2+sportmarks); avg=tot/3; cout<<"\n\n\tRoll No :"<<rno<<"\n\tTotal :"<<tot; cout<<"\n\tAverage :"<<avg<<"\n"; } }; int main() { statement obj; obj.get(); obj.getsm(); obj.display(); }