Lee_assig25a

# Lee_assig25a - <<"and the total sales for...

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

Sheet1 Page 1 //Cheu Lee Assig 25 #include <iostream> using std::cout using std::cin using std::endl using std::fixed #include <iomanip> using std::setprecision using std::setw int main() { const int pp = 4 //people const int pd = 5 //product double sales[pp][pd] = { 0 } double dv //dollar value double ts //total sales double ps[ pd ] = { 0 } int salesperson int product cout << "Enter the salesperson (1-4), product number (1-5) and total sales."<<endl cout << "Enter -1 for the program to total input.\n" cin >> salesperson while ( salesperson != -1 ) { cin >> product >> dv sales[ salesperson ][ product ] += dv cin >> salesperson } cout << "\nThe total sales for each salesperson " << "are displayed\nat the end of each row,"

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: << "and the total sales for each\nproduct " << "are displayed at the bottom of each column.\n" << setw( 10 ) << 1 << setw( 10 ) << 2 << setw( 10 ) << 3 << setw( 10 ) << 4 << setw( 10 ) << 5 << setw( 12 ) << " Total Product\n" << fixed << setprecision( 2 ) for ( int i = 1 i < pp ++i ) { ts = 0.0 cout << i for ( int j = 1 j < pd ++j ) { ts += sales[ i ][ j ] cout << setw( 10 ) << sales[ i ][ j ] ps[ j ] += sales[ i ][ j ] } cout << setw( 10 ) << ts << '\n' } cout << "\nTotal" << setw( 6 ) << ps[ 1 ] Sheet1 Page 2 for ( int j = 2 j < pd ++j ) cout << setw( 10 ) << ps[ j ] cout << endl return 0 }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

Lee_assig25a - <<"and the total sales for...

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

View Full Document
Ask a homework question - tutors are online