A small business has four (4) salesmen. The salesmen are named:
1. Edward
2. Richard
3. Lewis
4. Lawrence

The salesmen each sell the same five (5) products numbered 1 - 5.

There is a file  here called data.txt  that contains the results of one week’s sales. Each line or record represents a sale made by one of the salesmen. One line or record might read:
                1    4    35
 

Therefore, the record above says that salesman 1, Edward, sold 35 units of product 1. A salesman may have made several similar sales during the week.
 

Read the data from the data file data.txt into a two-dimensioned array. As mentioned before, a salesman may make several sales, so every time you encounter a sales record for a salesman, you must add the sales to the previous sales for that product for that salesman. Use the two-dimensioned array and possibly another array that holds the salesmen’s names to produce a table that resembles the one below.
 

Salesman     Product 1     Product 2     Product 3     Product 4     Product 5
Edward          35                  75               80               90               45
Richard          90                  60               32               18               43
Lewis             51                  71               34               39               30
Lawrence       40                  30               11               25               60
Totals:          216                236             157             172             178
 

The numbers above do NOT represent the values in data.txt. They are for illustration purposes only.

·  Quick Primer on ifstream usage
·  Working Example of ifstream usage
·  Data file for Assignment
 
 

1
Hosted by www.Geocities.ws

1