I am having trouble getting my program to store values and to be changed throughout the functions. Any help would be much appreciated. Here is the code.
#include <iostream>
using namespace std;
void DisplayMenu(void);
void Enter_Inventory();
int Display_Inventory(int inventory_number_coke, int inventory_number_pepsi, int inventory_number_cd, int inventory_number_hires);
void Purchase_Soda();
int main()
{
const char SENTINEL = 'Q';
char Choice;
do
{
DisplayMenu();
cin >> Choice;
cout << " " << endl;
switch (Choice)
{
case 'E': case 'e':
void Enter_Inventory();
break;
case 'P': case 'p':
void Purchase_Soda();
break;
case 'S': case 's':
cout << "This is sell" << endl;
break;
case 'D': case 'd':
cout << "This is display" << endl;
break;
default:
cout << "You typed in your entry wrong! Please choose again." << endl;
}
} while (Choice != SENTINEL);
return 0;
}
void DisplayMenu(void)
{
cout << "(E)nter inventory" << endl;
cout << "(P)urchase soda" << endl;
cout << "(S)ell soda" << endl;
cout << "(D)isplay inventory" << endl;
cout << "(Q)uit program" << endl;
cout << " " << endl;
cout << "Please choose by typing the first letter of your choice below." << endl;
cout << " " << endl;
cout << "Choice? ";
}
void Enter_Inventory()
{
int product_value;
int INC, INP, INCD, INH;
int inventory_number_coke=0;
int inventory_number_pepsi=0;
int inventory_number_cd=0;
int inventory_number_hires=0;
cout << "Enter the product number of the inventory you want to submit!" << endl;
cin >> product_value;
void Display_Inventory(void);
cout << "Please enter the number of cases" << endl;
cout << " " << endl;
if (product_value == 1)
{
INC = Display_Inventory(inventory_number_coke);
cin >> INC;
}
else if (product_value == 2)
{
INP = Display_Inventory(inventory_number_pepsi);
cin >> INP;
}
else if (product_value == 3)
{
INCD = Display_Inventory(inventory_number_cd);
cin >> INCD;
}
else if (product_value == 4)
{
INH = Display_Inventory(inventory_number_hires);
cin >> INH;
}
else
{
cout << "Please re-type selection" << endl;
}
}
int Display_Inventory(int inventory_number_coke, int inventory_number_pepsi, int inventory_number_cd, int inventory_number_hires)
{
cout << "|----------------------------------------|" << endl;
cout << "| Product---- Name ----# of cases--|" << endl;
cout << "| Number ---- ---- --|" << endl;
cout << "|----------------------------------------|" << endl;
cout << "| 1 ---- Coca-Cola ---- " << inventory_number_coke << " --|" << endl;
cout << "|----------------------------------------|" << endl;
cout << "| 2 ---- Pepsi ---- " << inventory_number_pepsi << " --|" << endl;
cout << "|----------------------------------------|" << endl;
cout << "| 3 ---- Canada Dry ---- " << inventory_number_cd << " --|" << endl;
cout << "|----------------------------------------|" << endl;
cout << "| 4 ---- Hires ---- " << inventory_number_hires << " --|" << endl;
cout << "|----------------------------------------|" << endl;
return inventory_number_coke, inventory_number_pepsi, inventory_number_cd, inventory_number_hires;
}
void Purchase_Soda()
{
cout << "|----------------------------------------|" << endl;
cout << "| Product---- Name ----# of cases--|" << endl;
cout << "| Number ---- ---- --|" << endl;
cout << "|----------------------------------------|" << endl;
cout << "| 1 ---- Coca-Cola ---- " << inventory_number_coke << " --|" << endl;
cout << "|----------------------------------------|" << endl;
cout << "| 2 ---- Pepsi ---- " << inventory_number_pepsi << " --|" << endl;
cout << "|----------------------------------------|" << endl;
cout << "| 3 ---- Canada Dry ---- " << inventory_number_cd << " --|" << endl;
cout << "|----------------------------------------|" << endl;
cout << "| 4 ---- Hires ---- " << inventory_number_hires << " --|" << endl;
cout << "|----------------------------------------|" << endl;
cout << " " << endl;
cout << "How much do you want to purchase?" << endl;
}
<< moderator edit: added [co[u][/u]de][/co[u][/u]de]
tags >>