hey i need help with writing a program where it lets a maker of chips and salsa keep track of sales...i have this so far but dont know what else to do.
# include <iostream>
# include <iomanip>
using namespace std;
int getTotal (int [], int);
int posOfLargest (int [], int);
int posOfSmallest(int [], int);
int main()
{
const int SIZE = 10;
const int NUM_TYPES = 5;
char name[NUM_TYPES] [SIZE] = {"mild", "medium", "sweet", "hot", "zesty"};
int sales[NUM_TYPES];
int totalJarsSold;
int hiSalesProduct;
int loSalesProduct;
for (int type = 0 ; type < NUM_TYPES ; type++ )
{
cout << "Jars sold last month of " << name[type] << ": " ;
cin >> sales[type] ;
while (sales[type] < 0 )
{ cout << "Jars sold must be 0 or more. Please re-enter: ";
cin >> sales[type];
}
}
cout << endl << endl ;
cout << " Salsa Sales Report \n\n";
cout << "Name Jars Sold \n";
cout << "______________________________\n";
for (int salsaType = 0 ; salsaType < NUM_TYPES; salsaType++)
{
cout << name[salsaType]
<< setw(21) << sales[salsaType]
<< endl;
}
cout << "\nTotal Sales:" << setw(15) << totalJarsSold << endl;
cout << "High Seller: " << name[hiSalesProduct] << endl;
cout << "Low Seller: " << name[loSalesProduct] << endl;
return 0;
}
int gettotal(int sales [], int SIZE) {
int total = 0 ;
int i;
for (i=0; i < SIZE ; i++){
total = total + sales[i];
}
return total ;
}
int getposOfLargest(int sales [], int SIZE){
int Largest=0;
int i;
for (i=1; i < SIZE ; i++){
if (sales[i] > sales[Largest])
Largest = i ;
}
return Largest;
}
int getposOfSmallest(int sales[], int SIZE) {
int Smallest = 0 ;
int i ;
for (i=1 ; i < SIZE ; i++) {
if (sales[i] < sales[Smallest])
Smallest = i ;
}
return Smallest ;
}