#include #include #include #include "bookclass.h" using namespace std; booktype::booktype() //constructor { } booktype::~booktype() //destructor { delete [] authorarray; } void booktype::showbook() { system("cls"); showtitle(); showauthor(); showpub(); showisbn(); showprice(); showstocknum(); } void booktype::showtitle() { cout << "Title: " << btitle << endl; } void booktype::settitle() { system("cls"); showbook(); cout << endl; cout << "ok what would you like the title to be ehh? -> "; cin >> btitle; cin.ignore(100, '\n'); cout << "ok"; getch(); } bool booktype::setequaltitle(string test) { if(btitle == test) return true; else return false; } void booktype::showstocknum() { cout << "Left in stock: " << bstock << endl; } void booktype::setstocknum() { } void booktype::updatestocknum() { system("cls"); showbook(); cout << endl; cout << "ok how many are in stock? -> "; cin >> bstock; cin.ignore(100, '\n'); cout << "ok"; getch(); } void booktype::returnstock() { } void booktype::showpub() { cout << "Publisher: " << bpublisher << endl; } void booktype::setpub() { system("cls"); showbook(); cout << endl; cout << "ok what would you like the publisher to be ehh? -> "; cin >> bpublisher; cin.ignore(100, '\n'); cout << "ok"; getch(); } bool booktype::setequalpub(string test) { if(bpublisher == test) return true; else return false; } void booktype::showisbn() { cout << "ISBN: " << bisbn << endl; } void booktype::setisbn() { system("cls"); showbook(); cout << endl; cout << "ok what would you like the isbn to be ehh? -> "; cin >> bisbn; cin.ignore(100, '\n'); cout << "ok"; getch(); } bool booktype::setequalisbn(string test) { if(bisbn == test) return true; else return false; } void booktype::showprice() { cout << "Price: " << bprice << endl; } void booktype::setprice() { system("cls"); showbook(); cout << endl; cout << "ok what would you like the price to be ehh? (99.99) -> "; cin >> bprice; cin.ignore(100, '\n'); cout << "ok"; getch(); } void booktype::setequalprice() { } void booktype::showauthor() { if(inputauthors > 1) cout << "Authors: "; else cout << "Author: "; int subcount; for(subcount = 0; subcount < inputauthors; subcount++) { cout << authorarray[subcount] << " "; if( subcount != inputauthors-1) cout << "and "; } cout << endl; } void booktype::setauthor() { bool quit = false; while(quit == false) { char author; system("cls"); cout << "how many authors are there? (1-4) -> "; cin >> author; switch(author) { case '1': inputauthors = 1; quit = true; break; case '2': inputauthors = 2; quit = true; break; case '3': inputauthors = 3; quit = true; break; case '4': inputauthors = 4; quit = true; break; default: cout << "there can't be that many authors"; quit = false; getch(); } } authorarray = new string [inputauthors]; int count; for(count = 0; count < inputauthors; count++) { cout << "input author #" << (count + 1) << " -> "; cin >> authorarray[count]; } } bool booktype::setequalauthor(string test) { int count; bool found = false; for(count = 0; count < inputauthors; count++) { if(authorarray[count] == test) found = true; else if(found != true) found = false; } return found; }