Question: C Programming: I've got most of this code down, I just need to fill in the part in bold. Prompt: You will need to read
C Programming:
I've got most of this code down, I just need to fill in the part in bold.
Prompt:
You will need to read from a file the number of people in each section or "cell" of memory mall. Then, you should determine which row or column of the grid has the most number of people in it.
Since these numbers represent the number of people in an area, it is guaranteed that all numbers for all input cases are non-negative.
#include
// Open the input file and read in the number of cases to process.
FILE* ifp = fopen("marketing.txt", "r");
int loop, numCases, best, cur;
int grid[ROWS][COLS], i, j;
fscanf(ifp, "%d", &numCases);
// Go through each input case.
for (loop=0; loop // Get this input grid. for (i=0; i for (j=0; j fscanf(ifp, "%d", &grid[i][j]); // Will store best value for row or column. best = 0; /*** FILL IN CODE HERE, TO UPDATE BEST, AS NEEDED. ***/ // Output result. printf("%d ", best); } fclose(ifp); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
