#include<iostream.h>
#include<conio.h>
#include<stidio.h>
class Library
{
int BookNo;
char BName[25];
char Author[25];
char Publisher[25];
float Price;
int No_of_Copies;
int No_of_Copies_Issued;
public:
void initial()
{
cout<<end1<<"Enter book number : ";
cout <<BookNo;
cout<<end1<<"Enter book name : ";
gets (Bname);
cout<<end1<<"Enter Author name : ";
gets (Author);
cout<<end1<<"Enter publisher name : ";
gets (publisher);
cout<<end1<<"Enter price : ";
cin>>Price;
cout<<endl<<"Enter Number of copies: ";
cin>>No_of_Copies;
}
void issue_book ()
{
cout<<"Enter book details......."<<end1;
initial();
if(No_of_Copies>0)
{
cout<<"enter How many book you want to issue:";
cin>>No_of_Copies_Issued;
if(No_of_Copies>=No_of_Copies_Issued)
{
No_of_Copies=No_of_Copies-No_of_Copies_Issued;
cout<<endl<<" "<<No_of_Copies_Issued<<" book is issued..";
display();
}
else
{
cout<<”Copies_Issued<<" books is not available in stock..";
}
}
else
{
cout<<"Book is not available";
}
}
void return_book()
{
cout<<"enter book detail you want to return...";
cout<<endl<<"Enter Book Number: ";
cin>>BookNo;
cout<<endl<<"Enter Book Name: ";
gets(BName);
No_of_Copies=No_of_Copies+No_of_Copies_Issued;
cout<<endl<<BookNo<<":"<<BName<<"Book is returned......";
}
void display()
{
cout<<"Book Number: "<<BookNo<<endl;
cout<<"Book Name: "<<BName<<endl;
cout<<"Author Name: "<<Author<<endl;
cout<<"publisher Name: "<<Publisher<<endl;
cout<<"Price: "<<Price<<endl;
}
};
void main ()
{
clrscr();
Library 11;
int ch;
cout<<"1->Issue book...."<<end1;
cout<<"2->Return Book....."<<end1;
cout<<"Enter your choice .. "<<end1;
cin>>ch;
switch(ch)
{
case 1:
11.issue_book();
break;
case 2:
11.return_book();
break;
}
getch();