Write a C++ Program for Library database
//Library Program
/*A Library shop maintains the inventory of books that are being sold at the shop
The list includes details such as author,title,price,publisher and stock position
Whenever a customer wants a book, the sales person inputs the title and author
and the system searches the list and displays whether it is available, the total cost
of the requested copies is displayed; otherwise the message "Required copies not in stock"
is displayed.
Design a system using a class called books with suitable member functions and constructors
Use New operator in constructors to allocate memory space required.
Write a program which suites above requirements.
*/
#include
#include
#include
class library
{
char author[15][20],title[15][20];
int price[15];
char pub[15][20];
int s;
public:
void getdata(void);
void display(void);
};
void library :: getdata(void)
{
cout<<"How many Entry you want to make :-"; cin>>s;
for(int i=0;i<<"\n\nEnter Author Name :- "; cin>>author[i];
cout<<"Enter Book Title :- "; cin>>title[i];
cout<<"Enter Price of Book :- "; cin>>price[i];
cout<<"Enter Publisher of Book :- "; cin>>pub[i];
}
}
void library :: display(void)
{
clrscr();
cout<
cout<
for(int a=0;a<40;a++)
cout<<"*-";
cout<
cout<
for(int b=0;b<40;b++)
cout<<"*-";
cout<
for(int i=0;i
{
cout<
}
}
void main()
{
clrscr();
library o1;
o1.getdata();
o1.display();
getch();
}