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 marks1;
- float marks2;
- public:
- void General(){
- cout<<"Enter roll number"<<endl;
- cin>>roll;
- cout<<"Enter marks1"<<endl;
- cin>>marks1;
- cout<<"Enter marks2"<<endl;
- cin>>marks2;
- }
- };
- class CPP_marks{
- protected:
- float CPP_marks;
- public:
- void programming(){
- cout<<"Enter marks"<<endl;
- cin>>CPP_marks;
- }
- };
- class result:public student_general_marks,public CPP_marks
- {
- protected:
- float avg;
- public:
- void resultdisplay(){
- avg=(marks1+marks2+CPP_marks)/3.00;
- cout<<"Avg is :"<<avg;
- }
- };
- int main(){
- result R;
- R.General();
- R.programming();
- R.resultdisplay();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement