// Function Prototypes
double CashierMod();
int InventoryMod();
double ReportMod();
char BookInfo();
int menu();
const int SIZE=50;
const int PRECISION=2;
const int NUM_BOOKS=10;
const double Tax = 0.06;
double Price, subTotal, totalSale;
char date;
struct Store
{
char ISBN [SIZE];
char title [SIZE];
char author [SIZE];
char publisher [SIZE];
char dateAdded [SIZE];
int onHand;
double wholeCost;
double retailCost;
};
char BookInfo()
{
Store BookInfo;
cout<<"Enter the book's ISBN number: \n";
cin.getline(BookInfo.ISBN, SIZE);
cout<<"Enter the title of the book: \n";
cin.getline(BookInfo.title, SIZE);
cout<<"Enter the author of the book: \n";
cin.getline(BookInfo.author, SIZE);
cout<<"Enter the publisher of the book: \n";
cin.getline(BookInfo.publisher,SIZE);
cout<<"Enter the date the book was added: \n";
cin.getline(BookInfo.dateAdded, SIZE);
cout<<"Enter the quantity of this book on hand: \n";
cin>>BookInfo.onHand;
cout<<"Enter the wholesale cost of the book: \n";
cin>>BookInfo.wholeCost;
cout<<"Enter the retail cost of the book: \n";
cin>>BookInfo.retailCost;
system ("pause");
return 0;
};
// The Main Module.
int main ()
{
int selection;
cout << fixed << showpoint << setprecision(2);
do
{
selection = menu();
switch(selection)
{
case 1 : CashierMod();
break;
case 2 : InventoryMod();
break;
case 3 : ReportMod();
break;
case 4 : BookInfo();
break;
case 5 : cout << "Exiting program.\n\n";
}
} while (selection != 5);
return 0;
}
// The Main Menu Module.
int menu()
{
int choice;
cout << "S & E Book Store\n";
cout << "\tMain Menu\n";
cout << "----------------\n";
cout << "1) Check Out\n";
cout << "2) Inventory\n";
cout << "3) Reports\n";
cout << "4) Book Information\n";
cout << "5) Exit Program\n";
cout << "Enter 1, 2, 3, 4, or 5: \n";
cin >> choice;
while (choice < 1 || choice > 5) // Validate input
{
cout << "Invalid Selection. Enter 1, 2, 3, 4, or 5: ";
cin >> choice;
}
return choice;
}
// The Cashier Module.
double CashierMod (double SubTotal, double Sales_Tax, double TotalSale)
{
int ISBN, Qty;
char date [SIZE];
cout << "S & E Book Store\n";
cout << "\tCash Register Menu\n";
cout << "----------------\n";
cout << "Please enter today's date: \n";
cin >> date; // Example: 10-Nov-2008.
cout << "Enter a valid ISBN: \n";
cin >> ISBN;
while (ISBN != 123)
{
cout << "Invalid selection. Enter a valid ISBN: \n";
cin >> ISBN;
}
cout << "Enter quantity for purchase: \n";
cin >> Qty;
// The Inventory Database Module.
int InventoryMod()
{
int choice;
while (true)
{
//Display the menu and get a choice
cout << endl;
cout << "S & E Book Store\n";
cout << "Inventory Database\n";
cout << "------------------\n";
cout << "1. Look-Up a Book\n";
cout << "2. Add a Book\n";
cout << "3. Edit a Books Record\n";
cout << "4. Delete a Book\n";
cout << "5. Return to the Main Menu\n";
cout << endl;
cout << "Enter your choice:" << endl;
cin >> choice;
switch (choice)
{
case 1: void lookUpbook();
break;
case 2: void addBook();
break;
case 3: void editBook();
break;
case 4: void deleteBook();
break;
case 5: cout << "Returning to main menu." << endl;
break;
}
//Validate and process the menu choice.
while (choice < 1 || choice > 5)
{
cout << "Please enter a number between one and five." << endl;
cin >> choice;
}
} while (choice != 5);
return 0;
}
//Add stub functions for inventory database
void lookUpBook()
{
//Get the title of the book to search for
cout << "Enter the title of the book you wish to search for. " << endl;
You have to go through tutorials for functions again.
Function declaration should give the skeleton. For example when u call a function if u expect to pass some values they must come in the bracket following it. double CashierMod(); // This is your function prototype
double CashierMod (double SubTotal, double Sales_Tax, double TotalSale)
//This is ur function definition
The above two does not match.
In the function prototype u r telling the compiler that "somewhere in th e program u will find a function CashierMod and while calling that function I will not be passing any argument to it. Also u will find a argumentless definition somewhere else."
But compiler cannot find such a definition.
In C++, by function overloading concepts, CashierMod() and CashierMod (double SubTotal, double Sales_Tax, double TotalSale) are 2 different functions.
Here u have used the double SubTotal, double Sales_Tax, double TotalSale
to initialize normal variables not variables declared for holding values which u will be passing, while calling the function. etc etc