I have most of the program written, but I'm stuck on the 2 dimensional array. Here is the code I have so far:

``````#include <iostream>

using namespace std;

//function prototype
int calcTotal();

int main()
{
//declare variable and array
int total = 0;
int sales = {{12000, 10000}, {45000, 56000}, {32000, 42000},
{67000, 23000}, {24000, 12000}, {55000, 34000}};

//calculate and display total sales
total = calcTotal();
cout << "Total sales: \$" << total << endl;

return 0;
}  //end of main function

//*****function definitions*****
int calcTotal()
{
//declare variables
int company = 0;
double salesAmts = 0.0;

//sales accumulator
for (int row = 0; row < 6; row = row + 1)
for (int col = 0; col < 2; col = col + 1)
//accumulate sales

company = company + salesAmts[row][col];
//end for col
//end for row
return company;
}  //end of calcTotal function``````

Hi,

I think you mean

``````int calcTotal(int sales)
{
//declare variables
int company = 0;
//sales accumulator
for (int row = 0; row < 6; row = row + 1)
for (int col = 0; col < 2; col = col + 1)
//accumulate sales
company = company + sales[row][col];
//end for col
//end for row
return company;
}  //end of calcTotal function``````

that should work if you array is always going to be fixed to  but will not if the size varies.

Hope this helps.

Thank you so much!!!