#include<iostream>
using namespace std;
class libo
{
  protected:
             int n,m[10],rn;
             char aut[20][10],bak[20][10],rd[20][10],td[20][10],name[10];
  public:
         void getbook()
          {
            cout<<"\n Books Details";
            cout<<"\n Enter the no.of books taken:";
            cin>>n;
            for(int i=0;i<n;i++)
             {
               cout<<"\n";
               cout<<"\n" <<(i+1)<<" Author Name:";
               cin>>aut[i];
               cout<<"\n Book Name:";
                cin>>bak[i];
               cout<<"\n Taken on:";
               cin>>td[i];
               cout<<"\n Return on:";
               cin>>rd[i];
               cout<<"\n No.of.copies:";
               cin>>m[i];
              }
        }
 };
class student:virtual public libo
{
 public:
           void getdata()
{
   cout<<"\n Enter student Name:";
   cin>>name;
   cout<<"\n Rollno:";
   cin>>rn;
}
};
class dis:public student
{
  public:
          void putdata()
{
   cout<<"\n Name:"<<name;
   cout<<"\n Rollno:"<<rn;
}
void putbook()
{
  cout<<"\n No.of.books:"<<n;
for(int j=0;j<n;j++)
{
  cout<<"\n\n"<<(j+1)<<"Book name:"<<bak[j];
  cout<<"\n Author Name:"<<aut[j];
  cout<<"\n Taken on:"<<td[j];
  cout<<"\n Returned on:"<<rd[j];
  cout<<"\n No.of.copies:"<<m[j];
}
}
};
int main()
{
  cout<<"\n Multilevel Inheritance";
  cout<<"\n ______________________";
  cout<<"\n Library Management";
  cout<<"\n __________________";
  dis h;
  cout<<"\n Input";
  h.getbook();
  h.getdata();
  cout<<"\n Output";
  cout<<"\n _____________________";
  h.putdata();
  h.putbook();
  return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: