Untitled
unknown
plain_text
2 years ago
722 B
6
Indexable
#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 sportsmarks; public: void getsm() { cout<<"\nEnter the sportsmarks:"; cin>>sportsmarks } }; class statement:public student,public sports { int tot,avg; public: void display() { tot=(m1+m2+sportsmarks); avg=tor/3; cout<<"\n\n\t Rool No:"<<no<<"\n\tTotal:"<<tot; cout<<"\n\n\t average:"<<avg<<"\n"; } }; int main() { statement obj; obj.getsm(); obj.getsm(); obj.display(); getch(); }
Editor is loading...