#include <iostream>
#include <string>
#include <array>
#include <limits>
using namespace std;
class book
{
std::string bookname;
std::string isbn;
std::string author;
std::string category;
float price;
int noc;
public:
const std::string& getBookname() const { return bookname; }
const std::string& getISBN() const { return isbn; }
const std::string& getAuthor() const { return author; }
const std::string& getCategory() const { return category; }
float getPrice() const { return price; }
float getNoC() const { return noc; }
void accept()
{
cout<<"Enter book name :- \n";
std::getline(std::cin, bookname);
cout<<"Enter isbn no of the book:- \n";
std::getline(std::cin, isbn);
cout<<"Enter authour name:- \n";
std::getline(std::cin, author);
cout<<"Enter category of book:- \n";
std::getline(std::cin, category);
cout<<"Enter price of the book :- \n";
std::cin>>price;
cout<<"Enter no of copies of book available in the library :- \n";
std::cin>>noc;
std::cin.ignore(std::numeric_limits<streamsize>::max(), '\n');
}
void display()
{
std::cout<<bookname<<std::endl;
std::cout<<isbn<<std::endl;
std::cout<<author<<std::endl;
std::cout<<category<<std::endl;
std::cout<<price<<std::endl;
std::cout<<noc<<std::endl;
}
void issue()
{
}
};
int main()
{
std::array<book, 5> b;
for(int i=0;i<b.size();++i)
{
b[i].accept();
}
std::string booksearch;
std::cout<<"Enter name of book member wants to issue :- \n";
std::getline(cin, booksearch);
std::cout<<"Searching for: " << booksearch << "\n";
for(int i=0;i<b.size();++i)
{
if (b[i].getBookname() == booksearch)
{
b[i].display();
b[i].issue();
break;
}
}
std::string dummy;
std::cout << "Hit return:";
std::getline(std::cin, dummy);
return 0;
}