author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Mon, 09 Sep 2013 15:51:32 +0200 | |
changeset 166 | ecd6492274ad |
parent 165 | f551b78c3eee |
permissions | -rw-r--r-- |
165
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
1 |
#include <cstdio> |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
2 |
#include <cstdlib> |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
3 |
|
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
4 |
#define CASEMAX 5 |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
5 |
|
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
6 |
void inittab (int arr[][CASEMAX], int cols) |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
7 |
{ |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
8 |
int i, j; |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
9 |
for (i = 0; i < cols; i++) { |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
10 |
for (j = 0; j < cols; j++) { |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
11 |
arr[i][j] = 0; |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
12 |
} |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
13 |
} |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
14 |
} |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
15 |
|
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
16 |
void display (int arr[][CASEMAX], int cols) |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
17 |
{ |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
18 |
|
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
19 |
int i, j; |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
20 |
|
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
21 |
for (i = 0; i < cols; i++) { |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
22 |
printf ("+--"); |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
23 |
for (j = 0; j < cols; j++) |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
24 |
printf ("-----"); |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
25 |
printf ("--+\n"); |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
26 |
|
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
27 |
for (j = 0; j < cols; j++) { |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
28 |
printf ("|%-4d", arr[i][j]); |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
29 |
} |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
30 |
|
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
31 |
printf ("|\n"); |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
32 |
} |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
33 |
|
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
34 |
printf ("+--"); |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
35 |
for (j = 0; j < cols; j++) |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
36 |
printf ("-----"); |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
37 |
printf ("--+\n"); |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
38 |
} |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
39 |
|
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
40 |
int main (int argc, char **argv) |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
41 |
{ |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
42 |
int cols = CASEMAX; |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
43 |
int arr[CASEMAX][CASEMAX]; |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
44 |
|
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
45 |
inittab (arr, cols); |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
46 |
display (arr, cols); |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
47 |
|
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
48 |
return EXIT_SUCCESS; |
f551b78c3eee
a bluetooth and a c++ demo
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff
changeset
|
49 |
} |