Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class student_general_marks{
- protected:
- int roll;
- float sub1;
- float sub2;
- public:
- void general(){
- cout<<"enter roll no"<<endl ;
- cin>> roll;
- cout<<"marks for sub1"<<endl;
- cin>>sub1;
- cout<<"marks for sub2"<<endl;
- cin>>sub2;
- }
- };
- class student_cpp_marks
- {
- protected:
- float cpp_marks;
- public:
- void programming ()
- {
- cout <<"marks for cpp"<<endl ;
- cin>>cpp_marks;
- }
- };
- class result : public student_general_marks,public student_cpp_marks
- {
- protected:
- float a;
- public:
- void resultdisplay ()
- {
- a=(sub1+sub2+cpp_marks)/3.00;
- cout<<"average is"<<a;
- }
- };
- int main(){
- result R;
- R.general();
- R.programming();
- R.resultdisplay();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement