#include <iostream>
using namespace std;
class student
{
public :
int rollno;
char name[50];
void studdet ()
{
cout <<"Enter your name :"<<endl;
cin >>name;
cout <<"Enter your roll no : "<<endl;
cin >>rollno;
}
};
class books:public student
{
public :
char book[100],author[100];
int n,i,d1,d2,d3,m1,m2,m3,y1,y2,y3;
void getdata ()
{
cout <<"Enter the no. of books you taken: ";
cin>>n;
cout <<n<<endl;
cout <<"Enter the date you taken the books : ";
cin>>d1>>m1>>y1;
cout <<"Enter the last date : "<<endl;
cin >>d2>>m2>>y2;
cout <<"Enter the submission date :"<<endl;
cin>>d3>>m3>>y3;
}
};
class library :public books
{
public :
void display ()
{
cout <<"****************************"<<endl;
cout <<"Name : "<<name <<endl;
cout <<"Roll no: "<<rollno<<endl;
cout <<"No. of books taken: "<<n<<endl;
cout<<"Enter the book and author name :"<<endl;
for (i=0;i<n;i++)
{
cin >>book>>author;
cout <<book<<"-"<<author<<endl;
}
cout <<"Issued Date : "<<d1<<"."<<m1<<"."<<y1<<endl;
cout <<"last date: "<<d2<<"."<<m2<<"."<<y2<<endl;
cout <<"submission date : "<<d3<<"."<<m3<<"."<<y3<<endl;
}
void check ()
{
if (d3>d2||m3>m2)
{
cout <<"\t pay fine "<<endl;
}
else
cout <<"\t No fine "<<endl;
}
};
int main() {
cout <<"\t \t Library management "<<endl;
library l;
l. studdet();
l. getdata();
l. display ();
l. check();
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: