I'm having trouble getting the nested loop to work correctly. The first for loop is not repeating the "Enter the sales for year" statement.
const unsigned int MONTHS = 12;
const unsigned int YEARS = 3;
int main()
{
displayHeader();
float yearlyArray[12][3];
inputAllSales(yearlyArray, MONTHS, YEARS);
system("pause");
return 0;
}
void inputAllSales(float monthlySales[12][3], const unsigned int numberOfRows, const unsigned int numberofColumns)
{
char* p_months[MONTHS] =
{
"January", "February", "March", "April", "May",
"June", "July", "August", "September", "October",
"November", "December"
};
for (int year = 0; year < YEARS; year++)
{
cout << "Enter the sales for year " << year << ":\n";
for (int month = 0; month <= MONTHS; month++)
{
cout << p_months[month] << " sales were:\t$";
float monthlyAmount[MONTHS];
cin >> monthlyAmount[month];
}
}
return;
}
Anyone able to help me out with this?

New Topic/Question
Reply



MultiQuote





|