Hello! When I build a solution for my program, it does not have any errors. However, in this particular screen (my menu screen), I cannot choose #1 (Cashier Module).[/B] What I mean is, when I enter 1, nothing appears. The choice 2, 3 and 4 do work, however.

Can anyone please tell me how to fix this? (A.K.A make my cashier module appear?)And please give me an example. I'm new to all of these things.

Thank you so much!!!

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

double salesTax = 0.06;                // Sales tax used for Merchandise total

// Function prototypes
int cashier();
int invMenu();
int bookInfo();
int reportsMenu();
int menu();
int mainScreen();

int main()
{
    int selection;

    cout << fixed << showpoint << setprecision(2);
    do
    {
         selection = menu();
        switch(selection)
        {
            case 1 :    cashier();
                        break;
            case 2 :    invMenu();
                        break;
            case 3 :    reportsMenu();
                        break;
            case 4 :    cout << "Exiting program.\n\n\n";
        }
    } while (selection != 4);
    return 0;
}

/*******************************************************
 *                     Main Menu                       *      
 *******************************************************/
int menu()
{
    int choice;

cout << "\nSERENDIPITY BOOKSELLERS\n";
cout << "--------------------------------\n";
cout << "Main Menu\n";
cout << "--------------------------------\n";
cout << "1) Cashier Module\n";
cout << "--------------------------------\n";
cout << "2) Inventory Database Module\n";
cout << "--------------------------------\n";
cout << "3) Report Module\n";
cout << "--------------------------------\n";
cout << "4) Exit\n";
cout << "--------------------------------\n\n";
cout << "Enter your choice ";
    
    cin  >> choice;
    while (choice < 1 || choice > 4)  // Check to see if user's input is correct
    {
        cout << "Invalid Selection. Enter 1, 2, 3 or 4: ";
        cin  >> choice;
    }
    return choice;
}

/**************************************************
 *                    Cashier					  *
 **************************************************/
int cashier()
{
	int bookQuantity;           // How many books are being purchased
	char date[8];				// Date (expects user to enter date in this format: YYYY/MM/DD
	char ISBN;					// The ISBN of the book
	char titleBook;				// The title of the book
    double salesTax,            // Fixed 6% Sales tax
           subTotal,            // Total price without sales tax
           priceTotal,          // Total price with sales tax
		   priceBook;			// Price of book

// Display Cashier Menu

        cin >> setw(8) >> date;
        cin >> bookQuantity;
        cin >> ISBN;
        cin >> titleBook;
        cin >> priceBook;
		cin >> subTotal;
		cin >> salesTax;
		cin >> priceTotal;


      	cout << "\nSERENDIPITY BOOKSELLERS\n";
		cout << "--------------------------------\n";
        cout << "											  " << endl;
        cout << "Date: " << endl;
        cout << "											  " << endl;
        cout << "Qty   ISBN        Title         Price  Total " << endl;
        cout << "_____________________________________________" << endl;
        cout << "                                             " << endl;
        cout << setprecision(2) << fixed;
        cout << "Subtotal: " << setw(6) << setprecision(2) << subTotal << endl;
        cout << "Tax: " << setw(6) << setprecision(2) << salesTax << endl;
        cout << "Total: " << setw(6) << setprecision(2) << priceTotal << endl;
        cout << "                              " << endl;
        cout << "Thank You for Shopping at Serendipity! " << endl; 

// Calculate subtotal
    subTotal = bookQuantity * priceBook;

// Calculate sales tax
    salesTax = 0.06 * subTotal;

// Calculate total price
    priceTotal = (bookQuantity * priceBook) * salesTax;

		return 0;

}

Oh, I have just noticed that my int cashier() has a few alignment problems. I'll try to fix that now. Maybe that's what's causing it?

EDIT: Nope. My cashier module is unfortunately still not showing.

EDIT #2: Oh and if you need my full source code, please don't hesitate to let me know. I'm just here refreshing away.

The first actual command of cashier is a cin on line 84. Your program is waiting for your input. Put any text to output before that.

The first actual command of cashier is a cin on line 84. Your program is waiting for your input. Put any text to output before that.

Never mind. Thanks for the help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.