Use a rectangular array to solve the following problem: A company has three sale
ID: 3657765 • Letter: U
Question
Use a rectangular array to solve the following problem: A company has three salespeople (1 to 3) who sell five different products (1 to 5). Once a day, each salesperson passes in a slip for each type of product sold. Each slip contains the following: a) The salesperson number b) The product number c) The total dollar value of that product sold that day Thus, each salesperson passes in between 0 and 5 sales slips per day. Assume that the information from all of the slips for last month is available. Write an application that will read all the information for last monthExplanation / Answer
#include using std::cout; using std::cin; using std::endl; using std::ios; #include using std::setiosflags; using std::setprecision; using std::setw; int main() { const int PEOPLE = 5, PRODUCTS = 6; double sales[ PEOPLE ][ PRODUCTS ] = { 0.0 }, value, totalSales, productSales[ PRODUCTS ] = { 0.0 }; int salesPerson, product; cout > salesPerson; while ( salesPerson != -1 ) { cin >> product >> value; sales[ salesPerson ][ product ] += value; cin >> salesPerson; } coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.