MULTI-LEVEL INHERITANCE

// MULTI-LEVEL INHERITANCE
#include
#include
class student
{
protected:
int rollno;
char name[30];
public:
void getdata()
{
cout<<"enter the student name:"< cin>>name;
cout<<"enter the roll no"<<"\n";
cin>>rollno;
}
void putdata()
{
cout<<"name"< cout<<"roll no"<}
};
class test:public student
{
protected:
int m1,m2,m3;
public:
void getmarks()
{
cout<<"enter the marks"< cin>>m1>>m2>>m3;
}
void putmarks()
{
cout<<"english :"< cout<<"maths :"< cout<<"chemistry:"<}
};
class result:public test
{
protected:
int total;
float avg;
public:
void display()
{
total=m1+m2+m3;
avg=total/3;
cout<<" \n\n \t\tSTUDENT DETAILS"< putdata();
putmarks();
cout<<"total :"< cout<<"average:"<}
};
void main()
{
clrscr();
result x;
x.getdata();
x.getmarks();
x.display();
getch();
}

Comments