Newbie here, having some difficulty with my structured array arguments being sent into the function. It appears my basic bloodshed compiler is not liking the functions I setup. I have made some improvements with the program overall but have been struggling with this for hours. I tried looking at comparable programs on this site but nothing similar enough for me to pin point the errors. My inventory function's job is to send a message saying sold out when the drink such as cola = 0. Any help would be greatly appreciated. I have moved my function definition from the bottom after int main to the top to clear a different compiler error. I am open to all feedback of any part of this program as it is a class assignment and can use pointers to have success on my next test. Thanks
#include<iostream>
#include<iomanip>
using namespace std;
struct Soda
{
string name;
float price;
int inv;
};
void functInventory(Soda[],int); //prototype
void functInventory(Soda drink[],int num) //function definition
{
if ( drink[num].inv = 0)
cout << "SOLD OUT" <<endl;
}
int main()
{
const int option = 5;
string cola, rbeer, lemlime, grape, cream;
int InsAmount, choice;
int income = 0;
Soda array[option] = {
{cola, .75, 20},
{rbeer, .75, 20},
{lemlime,.75, 20},
{grape, .80, 20},
{cream, .80, 20}
};
cout << "Please choose 1-6 " << endl;
cout << " 1. Cola = $.75 " << endl;
cout << " 2. Root Beer = $.75 " << endl;
cout << " 3. Lemon Lime = $.75 " << endl;
cout << " 4. Grape Soda = $.80 " << endl;
cout << " 5. Cream Soda = $.80 " << endl;
cout << " 6. QUIT & EXIT " << endl;
switch(choice)
{
case 1: array[0].inv - 1 = array[0].inv;
income = income + .75;
functInventory(array, choice);
break;
case 2: array[1].inv - 1 = array[1].inv;
income = income + .75;
functInventory(array, choice);
break;
case 3: array[2].inv - 1 = array[2].inv;
income = income + .75;
functInventory(array, choice);
break;
case 4: array[3].inv - 1 = array[3].inv;
income = income + .80;
functInventory(array, choice);
break;
case 5: array[4].inv - 1 = array[4].inv;
functInventory(array, choice)
income = income + .80;
break;
case 6: cout << "The total amount earned is: $" << income <<endl;
break;
default:
cout << "Please enter a capital letter from 1-6 " << endl;
}
cout << "Please Tell Me How Much Money You Are Inserting: " <<endl;
cin >> InsAmount;
change = InsAmount - .75; //I will work on creating a more accurate function 4 change
cout << "your change is " << change; << " "<< endl;
return 0;
}