本文整理汇总了C++中Inventory::getBooks方法的典型用法代码示例。如果您正苦于以下问题:C++ Inventory::getBooks方法的具体用法?C++ Inventory::getBooks怎么用?C++ Inventory::getBooks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory::getBooks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Display_Rep
//******************************************************
// FUNC :REPORT MENU SCREEN (COMPLETE)
//******************************************************
void Display_Rep(){
z:
vector<BookRecord> Rep = Invent.getBooks();
Report BookstoreReport(Rep);
Clear_Screen();
BaseMenu* baseMenuPtr;
ReportMenu repMenu;
baseMenuPtr = &repMenu;
baseMenuPtr->printMenu();
cout << endl;
cout << "\nEnter your choice: ";
int choice;
cin >> choice;
switch (choice) {
case 1:{
Clear_Screen();
BookstoreReport.reportInventoryList();
cout << "Do you want to continue (y/n)?: ";
char ans;
cin >> ans;
if (ans == 'y' || ans == 'Y')
goto z;
else
goto end;
}
case 2:{
Clear_Screen();
BookstoreReport.reportWholesale();
cout << "Do you want to continue (y/n)?: ";
char ans;
cin >> ans;
if (ans == 'y' || ans == 'Y')
goto z;
else
goto end;
}
case 3:{
Clear_Screen();
BookstoreReport.reportRetail();
cout << "Do you want to continue (y/n)?: ";
char ans;
cin >> ans;
if (ans == 'y' || ans == 'Y')
goto z;
else
goto end;
}
case 4:{
Clear_Screen();
BookstoreReport.reportQuantity();
cout << "Do you want to continue (y/n)?: ";
char ans;
cin >> ans;
if (ans == 'y' || ans == 'Y')
goto z;
else
goto end;
}
case 5:{
Clear_Screen();
BookstoreReport.reportCost();
cout << "Do you want to continue (y/n)?: ";
char ans;
cin >> ans;
if (ans == 'y' || ans == 'Y')
goto z;
else
goto end;
}
case 6:{
Clear_Screen();
BookstoreReport.reportAge();
cout << "Do you want to continue (y/n)?: ";
char ans;
cin >> ans;
if (ans == 'y' || ans == 'Y')
goto z;
else
goto end;
}
case 7:{
end:
Rep.clear();
Clear_Screen();
Display_Main();
}
}
}
示例2: Display_Cash
//******************************************************
// FUNC :CASHIER SCREEN (INCOMPLETE)
//******************************************************
void Display_Cash(){
vector<BookRecord>& rep = Invent.getBooks();
Cashier BookStoreCashier(rep);
z:
Clear_Screen();
BaseMenu *baseMenuPtr;
CashierMenu cashMenu;
baseMenuPtr = &cashMenu;
baseMenuPtr->printMenu();
cout << "\nEnter your choice: ";
int choice;
cin >> choice;
cout << endl;
switch (choice) {
case 3:{
Clear_Screen();
string ISBNTemp;
cout << "Enter the ISBN for the Book: ";
cin >> ISBNTemp;
BookStoreCashier.lookupBook(ISBNTemp);
cout << "Do you want to continue (y/n)?: ";
char ans;
cin >> ans;
if (ans == 'y' || ans == 'Y')
goto z;
else
goto end;
}
case 2:{
Clear_Screen();
string ISBNTemp;
cout << "Enter the ISBN for the Book: ";
cin >> ISBNTemp;
BookStoreCashier.returnBook(ISBNTemp);
cout << "Do you want to continue (y/n)?: ";
char ans;
cin >> ans;
if (ans == 'y' || ans == 'Y')
goto z;
else
goto end;
}
case 1:{
const double Sales_Tax = 0.10;
vector<BookRecord>& rep = Invent.getBooks();
Cashier BookStoreCashier(rep);
int counter = 0;
vector<string> bookISBN;
vector<double> bookQuantity;
vector<double> subTotals;
bool morebook = true;
while (morebook){
string x;
long y;
cout << "Enter ISBN of purchased book" << endl;
cin >> x;
cout << "Enter Quantity of books purchased" << endl;
cin >> y;
bookISBN.push_back(x); // Vector of book ISBNs
bookQuantity.push_back(y); // Vector of book quantities
cout << "Do you have more books (y/n)?: ";
char ans;
cin >> ans;
if (ans == 'y' || ans == 'Y'){
counter++;
}else{
morebook = false;
}
}
for (int i = 0; i < bookISBN.size(); i++){
long j = BookStoreCashier.searchBooks(bookISBN[i]); // Search if ISBNS exist
if (j < 0){
cout<<"ERROR: BOOK NOT FOUND"<<endl;
return;
}
long k = rep[j].quantityOnHand;
// Check to see if quantity on hand is less than quantity requested
if (k<bookQuantity[i]){
cout << "Not Enough "<<rep[j].title<<" in Store, only "<< k << endl;
bookQuantity[i] = k;
rep[j].quantityOnHand = 0;
}else{
cout << "Quanity decrease by "<<bookQuantity[i]<<" Current amount: "<<rep[j].quantityOnHand<<endl;
for(int i =0; i< bookQuantity[i]; i++)
rep[j].quantityOnHand -= bookQuantity[i];
}
}
for (int i = 0; i < bookISBN.size(); i++){
long j = BookStoreCashier.searchBooks(bookISBN[i]);
subTotals.push_back(rep[j].retailPrice * bookQuantity[i]);
}
Clear_Screen();
cout << "Group 3's Bookstore" << endl<<endl;
time_t t = time(0);
struct tm * now = localtime( & t );
cout << "Date: "<<(now->tm_year + 1900) << '-' << (now->tm_mon + 1) << '-'<< now->tm_mday<< endl<<endl<<endl;
//.........这里部分代码省略.........