void reportCheckout(Patron p, Book b, int test) { /*receives a patron, book and the test value based on test value prints out if book is checked out to patron returns nothing */ if (test==1) cout<< b.getID()<<" is checked out to "<<p.getID()<<".\n"; else cout<<b.getID()<<" could not be checked out to "<< p.getID()<<".\n"; }
void Library::showBooks() const { IdentNum i; if (books.size()==0) cout << "Nao existem livros registados.\n"; else { cout << "#### Livros ####\n"; cout << "---------------------------------------------------------------------------- \n"; cout << "| ID | Titulo | Autor | Disp. |\n"; cout << "---------------------------------------------------------------------------- \n"; cout << setiosflags(ios::left); for (i=1;i<=books.size();i++) { Book bookTemp = getBookByID(i); cout << "| " << setw(MAXIDLENGTH) << bookTemp.getID() << "| " << setw(MAXTITLELENGTH) << bookTemp.getTitle() << "| " << setw(MAXAUTHORLENGTH) << bookTemp.getAuthor() << "| " << setw(MAXQUANTITYLENGTH) << bookTemp.getNumAvailable() << "|\n"; } cout << resetiosflags(ios::left); cout << "---------------------------------------------------------------------------- \n"; } }
//book searching functions void book_id_search() { cout << "Enter the book's ID:" << endl; int id; cin >> id; Category *tmp1 = beginning; Book *tmp; system("CLS"); cout << "Searching..." << endl; int i = 0; while (tmp1 != NULL) { tmp = tmp1->getHead(); while (tmp != NULL) { if (tmp->getID() == id) { i++; tmp->print(); book_menu(tmp); return; } tmp = tmp->getNext(); } tmp1 = tmp1->getNext(); } if (i == 0) { system("CLS"); cout << "No such ID was found." << endl; cout << "Please try again" << endl; } }