equal
deleted
inserted
replaced
|
1 #include <cstdio> |
|
2 #include <cstdlib> |
|
3 |
|
4 #define CASEMAX 5 |
|
5 |
|
6 void inittab (int arr[][CASEMAX], int cols) |
|
7 { |
|
8 int i, j; |
|
9 for (i = 0; i < cols; i++) { |
|
10 for (j = 0; j < cols; j++) { |
|
11 arr[i][j] = 0; |
|
12 } |
|
13 } |
|
14 } |
|
15 |
|
16 void display (int arr[][CASEMAX], int cols) |
|
17 { |
|
18 |
|
19 int i, j; |
|
20 |
|
21 for (i = 0; i < cols; i++) { |
|
22 printf ("+--"); |
|
23 for (j = 0; j < cols; j++) |
|
24 printf ("-----"); |
|
25 printf ("--+\n"); |
|
26 |
|
27 for (j = 0; j < cols; j++) { |
|
28 printf ("|%-4d", arr[i][j]); |
|
29 } |
|
30 |
|
31 printf ("|\n"); |
|
32 } |
|
33 |
|
34 printf ("+--"); |
|
35 for (j = 0; j < cols; j++) |
|
36 printf ("-----"); |
|
37 printf ("--+\n"); |
|
38 } |
|
39 |
|
40 int main (int argc, char **argv) |
|
41 { |
|
42 int cols = CASEMAX; |
|
43 int arr[CASEMAX][CASEMAX]; |
|
44 |
|
45 inittab (arr, cols); |
|
46 display (arr, cols); |
|
47 |
|
48 return EXIT_SUCCESS; |
|
49 } |