# 25 - cout<< totalSales<<\n...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 #include <iostream> using namespace std int main() { const int PEOPLE = 5 const int PRODUCTS = 6 double sales[PEOPLE][PRODUCTS] = { 0 } double value double totalSales double productSales[ PRODUCTS ] = { 0 } int salesperson int product cout << "Enter the salesperson (1-4), " << "product number (1-5)\nand total sales." << "Enter -1 for the salesperson to end input.\n" cin >> salesperson while ( salesperson != -1 ) { cin >> product >> value sales[ salesperson ][ product ] += value cin >> salesperson } cout << "\nThe total sales for each sales person " << "are displayed\nat the end of each row," << "and the total sales for each\nproduct " << "are displayed at the bottom of each column.\n" for ( int i = 1 i < PEOPLE ++i ) { totalSales = 0 t cout << i c for ( int j = 1 j < PRODUCTS ++j ) { totalSales += sales[ i ][ j ] t cout<< sales[ i ][ j ] productSales[ j ] += sales[ i ][ j ]

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } cout << totalSales << '\n' } cout << "\nTotal" << productSales[ 1 ] c for ( int j = 2 j < PRODUCTS ++j ) cout << productSales[ j ] cout << endl return 0 } _____________________________________________________________ #include <iostream> using namespace std Sheet1 Page 2 int main() { int i, j, a, b const int salesperson = 4 const int products = 5 int sales[salesperson][products] for (i = 1 i < salesperson i++) { for (j = 1 j < products j++) { cout << "Input salesperson's number: " cin >> sales[i][j] cout << "Input product number: " cin >> sales[i][j] cout << "Input total value of that product sold that day: " cin >> sales[i][j] } } cout << "Summary Table" for (a=1 a<5 a++) { cout << "Product " << a } cout << "Total \n" for (b=1 b<6 b++){ cout << "Salesperson " << b << endl } cout << "Total " return 0 }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

25 - cout<< totalSales<<\n...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online