Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sanjayengineer121/46038c4445b5f4d8baacd69af123e570 to your computer and use it in GitHub Desktop.
Save sanjayengineer121/46038c4445b5f4d8baacd69af123e570 to your computer and use it in GitHub Desktop.
multiple inheritance
#include<iostream>
using namespace std;
class a{
protected:
int sa,a1,b1;
public:
san(){
cout<<"\n Enter the name No";
cin>>sa;
cout<<"\n Enter The mark";
cin>>a1>>b1;
}
};
class b{
protected:
char grade;
int Per;
public:
san1(){
cout<<"\n Enter percantage of score";
}};
class c : public a,public b
{
int total ,avg,grade;
public:
void display(){
total=a1+b1;
avg=(a1+b1)/2;
cout<<"~~~Total mark\n"<<total;
cout<<"\n~~Average~~\n"<<avg;
cout<<"roll no"<<sa;
cout<<"\n Enter grade";
if (total>100 && (total)<120)
{
cout<<"your grade is D";
}
if ((total)>120 && (total)<150)
{
cout<<"your grade is C";
}
if ((total)>150 && (total)<180)
{
cout<<"Your grade is B";
}
if((total)>180 && (total)>190)
{
cout<<"Your grade is A";
}
}
};
int main()
{
c a;
a.san();
a.san1();
a.display();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment