Problem: Maximal Advertising Business is going well for your roommate, who is se
ID: 3678727 • Letter: P
Question
Problem: Maximal Advertising
Business is going well for your roommate, who is selling discounts to area clubs and restaurants, which means that business is going well for you! Your program for keeping track of everyone's accounts is working perfectly.
Both of you have decided that you'll advertise on memory mall, which is roughly arranged as a rectangle. You've decided that there's not enough time before a football game to get to everyone arranged on the mall, but that you will only be able to walk through one "row" or "column" of the huge grid for advertising purposes.
Naturally, you'd like to hit as many people as possible as you make your single walk through. For this assignment you'll complete a program that reads in the number of people in each "cell" of memory mall, which is arranged like a 20 x 5 grid of cells, and determines the maximum number of people in any row or column of the grid.
For example, (this example is on a smaller grid to illustrate the idea), if the following was the input grid, where each number represents the number of people tailgating in that cell,
if we select the third column shaded blue, we would advertise to 1500 people. This is more than if we chose any of the other columns or rows.
Note: Since these numbers represent number of people in an area, it is guaranteed that all numbers for all input cases are non-negative.
Add your code in the designated area to the file marketing-scaffold.c.
After you add the correct code, if you run your program on the input file marketing.txt, your output should match the output in marketing.out.
(Here is the additional information)
marketing-scaffold.c. file
marketing.out.
200 20 500 19 25 44 5 16 50 30 400 15 80 93 2 14 19 40 600 0 30 18 92 19Explanation / Answer
{
sumRow= sumRow+grid[i][j];
{
sumCol= sumCol+ grid[i][j];
}
if(best1> best 2)
best=best1;
else
best=best2;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.