0
|
1 // テスト
|
|
2
|
|
3 void sub1(int &a[], int n)
|
|
4 {
|
|
5 int i;
|
|
6
|
|
7 for (i=0; i<n; i+=1) {
|
|
8 a[i] = i * 2;
|
|
9 }
|
|
10 }
|
|
11
|
|
12 void print_sub(string str, int &a)
|
|
13 {
|
|
14 print(str + str(a) + "です。\n");
|
|
15 }
|
|
16
|
|
17 void sub2(int &a[], int n)
|
|
18 {
|
|
19 int i;
|
|
20
|
|
21 for (i=0; i<n; i+=1) {
|
|
22 print_sub("a[" + str(i) + "] = ", a[i]);
|
|
23 }
|
|
24 }
|
|
25
|
|
26 /*
|
|
27 void sub2(int &a[], int n)
|
|
28 {
|
|
29 int i;
|
|
30
|
|
31 for (i=0; i<n; i+=1) {
|
|
32 print("a[" + str(i) + "] = " + str(a[i]) + "です。\n");
|
|
33 }
|
|
34 }
|
|
35 */
|
|
36 int main()
|
|
37 {
|
|
38 int value[10];
|
|
39
|
|
40 sub1(value, 10);
|
|
41 sub2(value, 10);
|
|
42
|
|
43 return 0;
|
|
44 }
|
|
45
|
|
46 /*
|
|
47 int sub(int &a, int &b);
|
|
48
|
|
49 int global;
|
|
50
|
|
51 int main()
|
|
52 {
|
|
53 int value;
|
|
54
|
|
55 value = 10;
|
|
56 global = 20;
|
|
57
|
|
58 print("sub(10, 20)の結果は" + str(sub(value, global)) + "です。\n");
|
|
59 print("value = " + str(value) + "です。\n");
|
|
60 print("global = " + str(global) + "です。\n");
|
|
61
|
|
62 return sub(value, global);
|
|
63 }
|
|
64
|
|
65 int sub(int &a, int &b)
|
|
66 {
|
|
67 b += 10;
|
|
68 return a;
|
|
69 }
|
|
70 */
|
|
71 /*
|
|
72 int main()
|
|
73 {
|
|
74 int a, b;
|
|
75
|
|
76 a = 10;
|
|
77 b = 0;
|
|
78
|
|
79 if (a > b && b == 0) {
|
|
80 print("真\n");
|
|
81 }
|
|
82 else {
|
|
83 print("偽\n");
|
|
84 }
|
|
85 return 0;
|
|
86 }
|
|
87 */
|