I have to create a program with parallele arrays that recieves information from a file telling it how many salsas their are (their can't be more than 10). One array containts the name of the salsa, the other array contains the number of salsa jars sold. Then I have to print the data. I'm not sure why but I keep having alot of problems. If anyone could help me out I would appreciate it.
Thanks, ACRobison02
#include <iostream>
using namespace std;
int getSalsaData (string [], int[]);
void DisplaySalsa (string [], int []);
int main ()
{
const int max = 10;
string salsa[max];
int numsold[max];
int numsalsa;
numsalsa=getSalsaData (salsa, numsold);
DisplaySalsa (salsa, numsold);
return 0;
}
int getSalsaData(string salsa[max], int numsold [max])
{
int numsalsa;
cin>>numsalsa;
for (int k=0; k<max; k++)
{
cin>>salsa[k];
cin>>numsold[k];
}
return numsalsa;
}
void DisplaySalsa(string salsa[max], int numsold[max])
{
cout<<"Salsa Type Jars Sold " <<endl;
for (int k=0; k<max; k++)
{
cin>>salsa[k];
cin>>numsold[k];
}
}