#include<iostream>
#include<stdio.h>
#include<string.h>
usingnamespace std;
class BOOKS
{
private :
staticconstint number_of_books = 2;
staticconstint length_of_book_names = 100;
char booknames[number_of_books][length_of_book_names];
char publisher[number_of_books][length_of_book_names];
char author[number_of_books][length_of_book_names];
float price[10];
int noofcopies[10];
char status[10];
char bookname[101];
public :
void getbooksinfo()
{
int i ; // local scope
cout<<"\nEnter The Information For Books :\n\n\n";
for (i = 0 ; i < number_of_books ; ++i)
{
cout<<"\nBOOK " << i + 1 ;
fflush(stdin);
cout<<"\nEnter The Name Of Book " ; cin.getline(booknames[i],length_of_book_names);
fflush(stdin);
cout<<"\nEnter The Author Name Please : " ; cin.getline(author[i],length_of_book_names);
fflush(stdin);
cout<<"\nEnter The Cost Of The book : " ; cin>>price[i];
fflush(stdin);
cout<<"\nEnter The Number Of Copies Available : " ; cin>>noofcopies[i];
fflush(stdin);
cout<<"\nEnter The Publisher Name : " ; cin.getline(publisher[i],length_of_book_names);
fflush(stdin);
cout<<"\nEnter The Status (I - Issued / A - Available ) : " ; cin>>status ;
}
}
void showbooksinfo()
{
int x ;
for (x = 0 ; x < number_of_books ; ++x)
{
cout<<"\n\nBook" << x + 1 ;
cout<<"\nName Of Book "; puts(booknames[x]);
cout<<"\nCost Of The Book : " << price[x];
cout<<"\nAuthor Of The Book : " ; puts(author[x]);
cout<<"\nPublisher Name : " ; puts(publisher[x]);
cout<<"\nNumber Of Copies Available : " <<noofcopies[x];
cout<<"\nStatus : " << status[x];
}
}
void checkavailablity()
{
int n ;
cout<<"\nEnter The Name Of The Book You Want To Issue : " ; cin.getline(bookname,101);
for (n = 0 ; n < number_of_books ; ++n)
{
if (strcmp(booknames[n],bookname))
cout<<"\nBOOK AVAILABLE!!!!";
break ;
else
cout<<"\nBook Not Available!!!! SORRY COME after 2 weeks!!!";
}
}
};
int main()
{
BOOKS obj ;
obj.getbooksinfo();
obj.showbooksinfo();
obj.checkavailablity();
return 0 ;
}