@Dave1/

SecretMistyCubase

C

No description

fork
loading
Files
  • main.c
  • marketing.txt
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Arup Guha
// 8/17/2015
// Scaffold to fill in for COP 3223 Common Lab - Marketing (2D arrays)

#include <stdio.h>

#define ROWS 20
#define COLS 5

int main() {

    // Open the input file and read in the number of cases to process.
    FILE* ifp = fopen("marketing.txt", "r");
    int loop, numCases;
    fscanf(ifp, "%d", &numCases);

    // Go through each input case.
    for (loop=0; loop<numCases; loop++) {

        // Get this input grid.
        int grid[ROWS][COLS], i, j;
        for (i=0; i<ROWS; i++)
            for (j=0; j<COLS; j++)
                fscanf(ifp, "%d", &grid[i][j]);

        // Will store best value for row or column.
        int best = 0;

        /*** FILL IN CODE HERE, TO UPDATE BEST, AS NEEDED. ***/
      for (int row = 0; row <ROWS; row ++)
      {
        int sum =0;
        for (int col =0; col < COLS; col++)
        sum
      }
        // Output result.
        printf("%d\n", best);
    }

    fclose(ifp);
    return 0;
}