View the step-by-step solution to:

# Here is my code: const int employee = 5, item = 6; double sales[employee][item] = { 0.0 }; double prodSales[item] = { 0.0 }; double total2 = 0.

Here is my code:

const int employee = 5, item = 6;

double sales[employee][item] = { 0.0 };

double prodSales[item] = { 0.0 };

double total2 = 0.0;

double value;

double totSale;

int salesEmp{};

int product{};

cout << "Enter the salesperson (1 - 4), product number (1 - 5), and total sales.n ";

cout << "Enter -1 for the salesperson to end input.n";

cin >> salesEmp;

while (salesEmp != -1){

cin >> product >> value;

sales[salesEmp][product] += value;

cin >> salesEmp;

}

cout << "nThe total sales for each sales employee is shown at the end of each row,n";

cout << "n The total sales for each product is shown at the bottom of each columnn";

cout << setw(12) << 1 << setw(12) << 2 << setw(12) << 3 << setw(12) << 4 << setw(12) << 5 << setw(13) << "Totaln" << fixed << setprecision(2);

for (int pq = 1; pq< employee; ++pq){

totSale = 0.0;

cout << pq;

for (int z = 1; z < item; ++z){

totSale += sales[pq][z];

cout << setw(12) << setprecision(2) << sales[pq][z];

prodSales[z] += sales[pq][z];

}

total2 += totSale;

cout << setw(15) << setprecision(3) << totSale<< 'n';

}

cout << "nTotal" << setw(8) << setprecision(2) << prodSales[1];

for (int xy = 2; xy < item; ++xy) {

cout << setw(15) << setprecision(3) << prodSales[xy];

cout << setw(15) << setprecision(3) << total2;

cout << endl;

}

For some reason my code is not working, would you be able to help me? I'm trying to get a tabular printout which should cross the totals on the right of the totaled rows and to the bottom of the totaled columns/

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents