当前位置: 首页>>代码示例>>C++>>正文


C++ Inventory::getBooks方法代码示例

本文整理汇总了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();
        }
            
    }
}
开发者ID:colphin,项目名称:Bookstore,代码行数:92,代码来源:main.cpp

示例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;
//.........这里部分代码省略.........
开发者ID:colphin,项目名称:Bookstore,代码行数:101,代码来源:main.cpp


注:本文中的Inventory::getBooks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。