#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <string.h>

#define STRING_LENGTH		64
#define BOOKLIST_LENGTH		5
#define CATALOG_LENGTH		20
#define VISITORS_LENGTH		20


/////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////        Author       //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
class Author
{
private:
	char		m_szAuthor[STRING_LENGTH];

public:
				Author					();
				Author					(const char * szAuthor);
				Author					(Author& A);
	Author&		operator=				(Author& A);
	Author&		operator=				(const char *szAuthor);
	bool		operator==				(const char *szAuthor);
	bool		operator==				(Author& A);
				operator const char*	();
};

Author::Author ()
{
	m_szAuthor[0]=0;
}

Author::Author (const char * szAuthor)
{
	strncpy (m_szAuthor,szAuthor,STRING_LENGTH);
}

Author::Author (Author& A)
{
	strcpy (this->m_szAuthor,A.m_szAuthor);
}

Author&	Author::operator= (Author& A)
{
	if (&A!=this)
	{
		strcpy (this->m_szAuthor,A.m_szAuthor);
	}
	return *this;
}

Author& Author::operator= (const char *szAuthor)
{
	strncpy (m_szAuthor,szAuthor,STRING_LENGTH);
	return *this;
}

bool Author::operator== (const char *szAuthor)
{
	return !strcmp (m_szAuthor,szAuthor);
}

bool Author::operator== (Author& A)
{
	return !strcmp (this->m_szAuthor,A.m_szAuthor);
}

Author::operator const char* ()
{
	return m_szAuthor;
}
/////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////        Title       ///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
class Title
{
private:
	char		m_szTitle[STRING_LENGTH];

public:
				Title					();
				Title					(const char * szTitle);
				Title					(Title& T);
	Title&		operator=				(Title& T);
	Title&		operator=				(const char *szTitle);
	bool		operator==				(const char *szTitle);
	bool		operator==				(Title& T);
				operator const char*	();
};

Title::Title ()
{
	m_szTitle[0]=0;
}

Title::Title (const char * szTitle)
{
	strncpy (m_szTitle,szTitle,STRING_LENGTH);
}

Title::Title (Title& T)
{
	strcpy (this->m_szTitle,T.m_szTitle);
}

Title&	Title::operator= (Title& T)
{
	if (&T!=this)
	{
		strcpy (this->m_szTitle,T.m_szTitle);
	}
	return *this;
}

Title& Title::operator= (const char *szTitle)
{
	strncpy (m_szTitle,szTitle,STRING_LENGTH);
	return *this;
}

bool Title::operator== (const char *szTitle)
{
	return !strcmp (m_szTitle,szTitle);
}

bool Title::operator== (Title& T)
{
	return !strcmp (this->m_szTitle,T.m_szTitle);
}

Title::operator const char* ()
{
	return m_szTitle;
}
/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////        Name       ///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
class Name
{
private:
	char		m_szName[STRING_LENGTH];

public:
				Name					();
				Name					(const char * szName);
				Name					(Name& N);
	Name&		operator=				(Name& N);
	Name&		operator=				(const char *szName);
	bool		operator==				(const char *szName);
	bool		operator==				(Name& N);
				operator const char*	();
};

Name::Name ()
{
	m_szName[0]=0;
}

Name::Name (const char * szName)
{
	strncpy (m_szName,s                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ator const char* ()
{
	return m_szName;
}
/////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////        Surname      //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
class Surname
{
private:
	char		m_szSurname[STRING_LENGTH];

public:
				Surname					();
				Surname					(const char * szSurname);
				Surname					(Surname& S);
	Surname&	operator=				                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                & T) :	m_Author(A),
									m_Title(T)
{
}

Book::Book (Book& B) :	m_Author(B.m_Author),
						m_Title(B.m_Title)
{
}

Book& Book::operator= (Book& B)
{
	if (&B!=this)
	{
		this->m_Author=B.m_Author;
		this->m_Title=B.m_Title;
	}
	return *this;
}

bool Book::operator== (Book& B)
{
	return (this->m_Author==B.m_Author && this->m_Title==B.m_Title);
}
/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////        Reader      ////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
class Reader
{
public:
	Name	m_Name;
	Surname	m_Surname;
public:
			Reader		();
			Reader		(Name& N, Surname& S);
			Reader		(Reader& R);
	Reader&	operator=	(Reader& R);
	bool	operator==	(Reader& R);
};

Reader::Reader ()
{
}

Reader::Reader (Name& N, Surname& S) :	m_Name(N),
										m_Surname(S)
{
}


Reader::Reader (Reader& R) :	m_Name(R.m_Name), 
								m_Surname(R.m_Surname)
{
}

Reader& Reader::operator= (Reader& R)
{
	if (&R!=this)
	{
		this->m_Name=R.m_Name;
		this->m_Surname=R.m_Surname;
	}
	return *this;
}

bool Reader::operator== (Reader& R)
{
	return (this->m_Name==R.m_Name && this->m_Surname==R.m_Surname);
}

/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////        BookInfo    //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
class BookInfo
{
public:
	Book		m_Book;
	Available	m_Available;
	QTY			m_QTY;
public:
				BookInfo	();
				BookInfo	(Book &B, QTY N);
				BookInfo	(BookInfo& BI);
	BookInfo&	operator=	(BookInfo& BI);
};

BookInfo::BookInfo ()
{
	m_Available=0;
	m_QTY=0;
}

BookInfo::BookInfo (Book &B, QTY N) :	m_Book (B), 
										m_Available(N), 
										m_QTY(N)
{
}


BookInfo::BookInfo (BookInfo& BI) :	m_Book (BI.m_Book),
									m_Available(BI.m_Available),
									m_QTY(BI.m_QTY)
{
}

BookInfo& BookInfo::operator= (BookInfo& BI)
{
	if (&BI!=this)
	{
		this->m_Book=BI.m_Book;
		this->m_Available=BI.m_Available;
		this->m_QTY=BI.m_QTY;
	}
	return *this;
}

/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////        BookList    //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
class BookList
{
public:
	int			m_nBooksCount;
	Book		m_Books[BOOKLIST_LENGTH];
public:
				BookList	();
				BookList	(BookList& BL);
	BookList&	operator=	(BookList& BL);
};

BookList::BookList ()
{
	m_nBooksCount=0;
}

BookList::BookList (BookList& BL)
{
	this->m_nBooksCount=BL.m_nBooksCount;
	for (int i=0; i< m_nBooksCount ;i++)
		this->m_Books[i]=BL.m_Books[i];
	
}

BookList& BookList::operator= (BookList& BL)
{
	if (&BL!=this)
	{
		this->m_nBooksCount=BL.m_nBooksCount;
		for (int i=0; i< m_nBooksCount ;i++)
			this->m_Books[i]=BL.m_Books[i];
	}
	return *this;
}
/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////      ReaderInfo    //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
class ReaderInfo
{
public:
	Reader		m_Reader;
	BookList	m_BookList;
public:
				ReaderInfo	();
				ReaderInfo	(Reader& R);
				ReaderInfo	(ReaderInfo &RI);
	ReaderInfo&	operator=	(ReaderInfo &RI);
};
ReaderInfo::ReaderInfo ()
{
}

ReaderInfo::ReaderInfo (Reader& R) : m_Reader(R)
{
}

ReaderInfo::ReaderInfo (ReaderInfo &RI)
{
	this->m_Reader=RI.m_Reader;
	this->m_BookList=RI.m_BookList;
}

ReaderInfo& ReaderInfo::operator= (ReaderInfo &RI)
{
	if (&RI!=this)
	{
		this->m_Reader=RI.m_Reader;
		this->m_BookList=RI.m_BookList;
	}
	return *this;
}

/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////        Catalog    ///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
class Catalog
{
public:
	int			m_nBooksInfoCount;
	BookInfo	m_BooksInfo[CATALOG_LENGTH];
public:
				Catalog		();
				Catalog		(Catalog& C);
	Catalog&	operator=	(Catalog& C);
};

Catalog::Catalog ()
{
	m_nBooksInfoCount=0;
}

Catalog::Catalog (Catalog& C)
{
	for (int i=0 ;i<C.m_nBooksInfoCount; i++)
		m_BooksInfo[i]=C.m_BooksInfo[i];
	m_nBooksInfoCount=C.m_nBooksInfoCount;
}

Catalog& Catalog::operator= (Catalog& C)
{
	if (&C!=this)
	{
		for (int i=0 ;i<C.m_nBooksInfoCount; i++)
			m_BooksInfo[i]=C.m_BooksInfo[i];
		m_nBooksInfoCount=C.m_nBooksInfoCount;
	}
	return *this;
}

/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////        Visitors    //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
class Visitors
{
public:
	int			m_nReadersInfoCount;
	ReaderInfo	m_ReadersInfo[VISITORS_LENGTH];
public:
				Visitors	();
				Visitors	(Visitors &V);
	Visitors&	operator=	(Visitors &V);
};

Visitors::Visitors ()
{
	m_nReadersInfoCount=0;
}

Visitors::Visitors (Visitors &V)
{	
	for (int i=0 ;i<V.m_nReadersInfoCount; i++)
		m_ReadersInfo[i]=V.m_ReadersInfo[i];
	m_nReadersInfoCount=V.m_nReadersInfoCount;
}

Visitors& Visitors::operator= (Visitors& V)
{
	if (&V!=this)
	{
		for (int i=0 ;i<V.m_nReadersInfoCount; i++)
			m_ReadersInfo[i]=V.m_ReadersInfo[i];
		m_nReadersInfoCount=V.m_nReadersInfoCount;
	}
	return *this;
}

/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////        Library    ///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
class Library
{
public:
	Visitors	m_Visitors;
	Catalog		m_Catalog;

public:
				Library		();
				Library		(Library &L);
	Library&	operator=	(Library &L);
};

Library::Library ()
{
}

Library::Library (Library &L)
{
	m_Visitors=L.m_Visitors;
	m_Catalog=L.m_Catalog;
}

Library& Library::operator= (Library &L)
{
	if (&L!=this)
	{
		m_Visitors=L.m_Visitors;
		m_Catalog=L.m_Catalog;
	}
	return *this;
}
/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////        Functions    /////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
bool IsBook (Book &B, Library &L)
{
	for (int i=0;  i<L.m_Catalog.m_nBooksInfoCount;  i++) 
		if (L.m_Catalog.m_BooksInfo[i].m_Book==B)
			return true;
	return false;
}


Available GetAvailable (Book &B, Library &L)
{
	for (int i=0;  i<L.m_Catalog.m_nBooksInfoCount;  i++) 
		if (L.m_Catalog.m_BooksInfo[i].m_Book==B)
			return L.m_Catalog.m_BooksInfo[i].m_Available;
	return 0;
}


QTY GetQTY (Book &B, Library &L)
{
	for (int i=0;i<L.m_Catalog.m_nBooksInfoCount;i++) 
		if (L.m_Catalog.m_BooksInfo[i].m_Book==B)
			return L.m_Catalog.m_BooksInfo[i].m_QTY;
	return 0;
}


bool IsReader (Reader &R, Library &L)
{
	for (int i=0;i<L.m_Visitors.m_nReadersInfoCount;i++) 
		if (L.m_Visitors.m_ReadersInfo[i].m_Reader==R)
			return true;
	return false;
}


bool HaveABook	(Book &B, Reader &R, Library &L)
{
	for(int i=0;  i<L.m_Visitors.m_nReadersInfoCount; i++)
		if (L.m_Visitors.m_ReadersInfo[i].m_Reader==R)
		{
			for(int j=0;  j<L.m_Visitors.m_ReadersInfo[i].m_BookList.m_nBooksCount; j++)
				if (L.m_Visitors.m_ReadersInfo[i].m_BookList.m_Books[j]==B)
					return true;
			return false;
		}
	return false;
}


Catalog BookInfoByBook (Book &B, Library &L)
{
	Catalog C;
 	for (int i=0;  i<L.m_Catalog.m_nBooksInfoCount;  i++) 
		if (L.m_Catalog.m_BooksInfo[i].m_Book==B)
		{
			C.m_BooksInfo[0]=L.m_Catalog.m_BooksInfo[i];
			C.m_nBooksInfoCount=1;
		}
	return C;
}

Visitors ReaderInfoByReader (Reader &R, Library &L)
{
	Visitors V;
 	for (int i=0;  i<L.m_Visitors.m_nReadersInfoCount;  i++) 
		if (L.m_Visitors.m_ReadersInfo[i].m_Reader==R)
		{
			V.m_ReadersInfo[0]=L.m_Visitors.m_ReadersInfo[i];
			V.m_nReadersInfoCount=1;
		}
	return V;
}

Library AddBook (Book &B, Library &L, QTY N)
{
	if (GetQTY (B,L) >0)
	{
		for (int i=0;  i<L.m_Catalog.m_nBooksInfoCount;  i++) 
			if (L.m_Catalog.m_BooksInfo[i].m_Book==B)
			{
				L.m_Catalog.m_BooksInfo[i].m_Available+=N;
				L.m_Catalog.m_BooksInfo[i].m_QTY+=N;
			}
	}
	else
	{
		L.m_Catalog.m_BooksInfo[L.m_Catalog.m_nBooksInfoCount].m_Book=B;
		L.m_Catalog.m_BooksInfo[L.m_Catalog.m_nBooksInfoCount].m_Available=N;
		L.m_Catalog.m_BooksInfo[L.m_Catalog.m_nBooksInfoCount].m_QTY=N;
		L.m_Catalog.m_nBooksInfoCount++;
	}
	return L;
}

Library DeleteBook (Book &B, Library &L, QTY N)
{
	if (N < GetAvailable (B,L))
	{
		for (int i=0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                sitors.m_ReadersInfo[j].m_Reader==R)
				{
					L.m_Visitors.m_ReadersInfo[j].m_BookList.m_Books[L.m_Visitors.m_ReadersInfo[j].m_BookList.m_nBooksCount]=B;
					L.m_Visitors.m_ReadersInfo[j].m_BookList.m_nBooksCount++;
					L.m_Catalog.m_BooksInfo[i].m_Available--;
				}
			}
		}
	return L;
}

Library ReturnBook (Book &B, Reader &R, Library &L)
{

	for (int j=0; j<L.m_Visitors.m_nReadersInfoCount; j++)
	{
		if (L.m_Visitors.m_ReadersInfo[j].m_Reader==R)
		{
			for (int k=0; k<L.m_Visitors.m_ReadersInfo[j].m_BookList.m_nBooksCount;k++)
			{
				if (L.m_Visitors.m_ReadersInfo[j].m_BookList.m_Books[k]==B)
				{
					for (int l=k+1; l<L.m_Visitors.m_ReadersInfo[j].m_BookList.m_nBooksCount;l++)
					{
						L.m_Visitors.m_ReadersInfo[j].m_BookList.m_Books[l-1]=L.m_Visitors.m_ReadersInfo[j].m_BookList.m_Books[l];
						L.m_Visitors.m_ReadersInfo[j].m_BookList.m_nBooksCount--;
					}
				}
			}
		}
	}
	for (int i=0;  i<L.m_Catalog.m_nBooksInfoCount;  i++) 
		if (L.m_Catalog.m_BooksInfo[i].m_Book==B)
			L.m_Catalog.m_BooksInfo[i].m_Available++;
	return L;
}

void ReadStr (char *str)
{
	char c;
	while ((c=getchar())!='\n')
		*str++=c;
	*str=0;	
}

void main ()
{
	char s;
	int n;
	int i;
	Book B;
	int nQTY;
	Reader R;
	Library L;
	BookList BL;
	char szTitle[STRING_LENGTH];
	char szAuthor[STRING_LENGTH];
	char szName[STRING_LENGTH];
	char szSurname[STRING_LENGTH];
	while (true)
	{
		do
		{
			cout << "Choose operation" << endl;
			cout << "1) Add book to library catalog" << endl;
			cout << "2) Add reader to library" << endl;
			cout << "3) Find book in library catalog" << endl;
			cout << "4) Find reader in library" << endl;
			cout << "5) Delete book from library catalog" << endl;
			cout << "6) Delete reader from library" << endl;
			cout << "7) Give book to reader" << endl;
			cout << "8) Return book to library" << endl;
			cout << "9) Show all books" << endl;
			cout << "10) Show all readers" << endl;
			cout << "11) Exit" << endl;
			cin >> n;
		}
		while (n<1 || n> 11);
		switch (n)
		{
		case 1:
			cout << "Input book's title" << endl;
			ReadStr (szTitle);
			cout << "Input book's author" << endl;
			ReadStr(szAuthor);
			do
			{
				cout << "Input books quantity" << endl;
				cin >> nQTY;
			}
			while (nQTY <= 0);
			L=AddBook (Book(Author(szAuthor),Title (szTitle)),L,nQTY);
			cout << "Successful adding book" << endl;
			break;
		case 2:
			cout << "Input reader's name" << endl;
			ReadStr (szName);
			cout << "Input r                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 endl;
			}
			else 
				cout << "Sorry, but we don't have " << B.m_Title << " by " << B.m_Author << " in our catalog" << endl;
			break;
		case 4:
			cout << "Input reader's name" << endl;
			ReadStr (szName);
			cout << "Input reader's surname" << endl;
			ReadStr (szSurname)	;
			R = Reader(Name (szName),Surname (szSurname));
			if (IsReader (R,L))
			{
				cout << "Reader " << R.m_Name << " " << R.m_Surname;
				BL=GetReaderBooks (R,L);
				if (BL.m_nBooksCount)
				{
					cout << " have such books:" << endl;
					for (i=0; i< BL.m_nBooksCount; i++)
						cout <<  BL.m_Books[i].m_Title << " by " << BL.m_Books[i].m_Author << endl;
				}
				else 
					cout << " have no books" << endl;
			}
			else 
				cout << "Sorry, but we don't reader" << R.m_Name << " " << R.m_Surname << " in our library" << endl;
			break;
		case 5:
			cout << "Input book title" << endl;
			ReadStr (szTitle);
			cout << "Input book author" << endl;
			ReadStr (szAuthor);
			do
			{
				cout << "Input how much books are you going to delete" << endl;
				cin >> nQTY;
			}
			while (nQTY <= 0);
			B = Book(Author(szAuthor),Title (szTitle));
			if (GetQTY (B,L)>0)
			{
				L=DeleteBook (B,L,nQTY);
				cout << "Successful deleting book" << endl;
			}
			else 
				cout << "Sorry, but we don't have " << B.m_Title << " by " << B.m_Author << " in our catalog" << endl;
			break;
		case 6:
			cout << "Input reader's name" << endl;
			ReadStr (szName);
			cout << "Input reader's surname" << endl;
	                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
						cout << "Sorry, but book " << B.m_Title << " by " << B.m_Author  << " wasn't registered in our catalog" << endl;
				}
				else
					cout << "Reader " << R.m_Name << " " << R.m_Surname << " doesn't have a book " << B.m_Title << " by " << B.m_Author << endl;
			}
			break;
		case 9:
			if (L.m_Catalog.m_nBooksInfoCount)
			{
				for (i=0; i<L.m_Catalog.m_nBooksInfoCount;i++)
					cout << L.m_Catalog.m_BooksInfo[i].m_Book.m_Title << " by " << L.m_Catalog.m_BooksInfo[i].m_Book.m_Author <<" Quantity: " << L.m_Catalog.m_BooksInfo[i].m_QTY << " Available: " << L.m_Catalog.m_BooksInfo[i].m_Available << endl;
			}
			else
				cout << "We have no books" << endl;
			break;
		case 10:
			if (L.m_Visitors.m_nReadersInfoCount)
			{
				for (i=0; i<L.m_Visitors.m_nReadersInfoCount;i++)
					cout << L.m_Visitors.m_ReadersInfo[i].m_Reader.m_Name << " " << L.m_Visitors.m_ReadersInfo[i].m_Reader.m_Surname << endl;
			}
			else
				cout << "We have no readers" << endl;
			break;
		case 11:
			return;
		}
	}
}
/*
void main ()
{
	int n;
	int i;
	Book B;
	int nQTY;
	Reader R;
	Library L;
	BookList BL;
	char szTitle[STRING_LENGTH];
	char szAuthor[STRING_LENGTH];
	char szName[STRING_LENGTH];
	char szSurname[STRING_LENGTH];
	while (true)
	{
		do
		{
			cout << "Choose operation" << endl;
			cout << "1) Add book to library catalog" << endl;
			cout << "2) Add reader to library" << endl;
			cout << "3) Find book in library catalog" << endl;
			cout << "4) Find reader in library" << endl;
			cout << "5) Delete book from library catalog" << endl;
			cout << "6) Delete reader from library" << endl;
			cout << "7) Give book to reader" << endl;
			cout << "8) Return book to library" << endl;
			cout << "7) Return book to library" << endl;
			cout << "9) Show all books" << endl;
			cout << "10) Show all readers" << endl;
			cout << "11) Exit" << endl;
			cin >> n;
		}
		while (n<1 || n> 11);
		switch (n)
		{
		case 1:
			cout << "Input book's title" << endl;
			cin >> szTitle;
			cout << "Input book's author" << endl;
			cin >> szAuthor;
			do
			{
				cout << "Input books quantity" << endl;
				cin >> nQTY;
			}
			while (nQTY <= 0);
			L=AddBook (Book(Author(szAuthor),Title (szTitle)),L,nQTY);
			cout << "Successful adding book" << endl;
			break;
		case 2:
			cout << "Input reader's name" << endl;
			cin >> szName;
			cout << "Input reader's surname" << endl;
			cin >> szSurname;
			L=AddReader (Reader (Name (szName),Surname (szSurname)),L);
			cout << "Successful adding reader" << endl;
			break;
		case 3:
			cout << "Input book title" << endl;
			cin >> szTitle;
			cout << "Input book author" << endl;
			cin >> szAuthor;
			B = Book(Author(szAuthor),Title (szTitle));
			if (GetQTY (B,L)>0)
			{
				cout << B.m_Title << " by " << B.m_Author <<" Quantity: " << GetQTY (B,L) << " Available: " << GetAvailable (B,L) << endl;
			}
			else 
				cout << "Sorry, but we don't have " << B.m_Title << " by " << B.m_Author << " in our catalog" << endl;
			break;
		case 4:
			cout << "Input reader's name" << endl;
			cin >> szName;
			cout << "Input reader's surname" << endl;
			cin >> szSurname;
			R = Reader(Name (szName),Surname (szSurname));
			if (IsReader (R,L))
			{
				cout << "Reader " << R.m_Name << " " << R.m_Surname;
				BL=GetReaderBooks (R,L);
				if (BL.m_nBooksCount)
				{
					cout << " have such books:" << endl;
					for (i=0; i< BL.m_nBooksCount; i++)
						cout <<  BL.m_Books[i].m_Title << " by " << BL.m_Books[i].m_Author << endl;
				}
				else 
					cout << " have no books" << endl;
			}
			else 
				cout << "Sorry, but we don't reader" << R.m_Name << " " << R.m_Surname << " in our library" << endl;
			break;
		case 5:
			cout << "Input book title" << endl;
			cin >> szTitle;
			cout << "Input book author" << endl;
			cin >> szAuthor;
			do
			{
				cout << "Input how much books are you going to delete" << endl;
				cin >> nQTY;
			}
			while (nQTY <= 0);
			B = Book(Author(szAuthor),Title (szTitle));
			if (GetQTY (B,L)>0)
			{
				L=DeleteBook (B,L,nQTY);
				cout << "Successful deleting book" << endl;
			}
			else 
				cout << "Sorry, but we don't have " << B.m_Title << " by " << B.m_Author << " in our catalog" << endl;
			break;
		case 6:
			cout << "Input reader's name" << endl;
			cin >> szName;
			cout << "Input reader's surname" << endl;
			cin >> szSurname;
			R = Reader(Name (szName),Surname (szSurname));
			if (IsReader (R,L))
			{
				if (GetReaderBooks(R,L).m_nBooksCount==0)
				{
					L=DeleteReader (R,L);
					cout << "Successful deleting reader" << endl;
				}
				else
					cout << "You couldn't delete " << R.m_Name << " " << R.m_Surname << ". Because he has books.";
			}
			else 
				cout << "Sorry, but we don't reader" << R.m_Name << " " << R.m_Surname << " in our library" << endl;
			break;
		case 7:
			cout << "Input book title" << endl;
			cin >> szTitle;
			cout << "Input book author" << endl;
			cin >> szAuthor;
			B = Book(Author(szAuthor),Title (szTitle));
			if (GetAvailable (B,L)>0)
			{
				cout << "Input reader's name" << endl;
				cin >> szName;
				cout << "Input reader's surname" << endl;
				cin >> szSurname;
				R = Reader(Name (szName),Surname (szSurname));
				if (IsReader (R,L))
				{
					if (!HaveABook(B,R,L))
					{
						L=GiveBook (B,R,L);
						cout << " Successful giving book" << endl;
					}
					else
						cout << "Sorry, but reader" << R.m_Name << " " << R.m_Surname << " is already has book " << B.m_Title << " by " << B.m_Author << endl;
				}
				else 
					cout << "Sorry, but we don't reader" << R.m_Name << " " << R.m_Surname << " in our library" << endl;
			}
			else 
				cout << "Sorry, but we don't have available" << B.m_Title << " by " << B.m_Author << " in our catalog now" << endl;
			break;
		case 8:
			cout << "Input reader's name" << endl;
			cin >> szName;
			cout << "Input reader's surname" << endl;
			cin >> szSurname;
			R = Reader(Name (szName),Surname (szSurname));
			if (IsReader (R,L))
			{
				cout << "Input book title" << endl;
				cin >> szTitle;
				cout << "Input book author" << endl;
				cin >> szAuthor;
				B = Book(Author(szAuthor),Title (szTitle));
				if (HaveABook(B,R,L))
				{
					if (IsBook (B,L))
					{
						L=ReturnBook (B,R,L);
						cout << " Successful returning book" << endl;
					}
					else
						cout << "Sorry, but book " << B.m_Title << " by " << B.m_Author  << " wasn't registered in our catalog" << endl;
				}
				else
					cout << "Reader" << R.m_Name << " " << R.m_Surname << " has no book " << B.m_Title << " by " << B.m_Author << endl;
			}
			break;
		case 9:
			if (L.m_Catalog.m_nBooksInfoCount)
			{
				for (i=0; i<L.m_Catalog.m_nBooksInfoCount;i++)
					cout << L.m_Catalog.m_BooksInfo[i].m_Book.m_Title << " by " << L.m_Catalog.m_BooksInfo[i].m_Book.m_Author <<" Quantity: " << L.m_Catalog.m_BooksInfo[i].m_QTY << " Available: " << L.m_Catalog.m_BooksInfo[i].m_Available << endl;
			}
			else
				cout << "We have no books" << endl;
			break;
		case 10:
			if (L.m_Visitors.m_nReadersInfoCount)
			{
				for (i=0; i<L.m_Visitors.m_nReadersInfoCount;i++)
					cout << L.m_Visitors.m_ReadersInfo[i].m_Reader.m_Name << " " << L.m_Visitors.m_ReadersInfo[i].m_Reader.m_Surname << endl;
			}
			else
				cout << "We have no readers" << endl;
			break;
		case 11:
			return;
		}
	}
}
*/
