blob: c283f7577dbe446a6467774c30062abe13bd2600 (
plain) (
blame)
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
|
namespace;
include rt;
int get(int[?] t, int i) {
return t[i];
}
int sum(int[?] t, int n) {
int s = 0, i = 0;
while (i < n) {
s = s + get(t, i);
i++;
}
return s;
}
int where() {
rt.trace();
return 1;
}
int outer() {
int r = where();
return r;
}
int main() {
int[?] t = rt.new(int[?]);
t.push(1); t.push(2); t.push(3); t.push(4);
rt.put_n(outer());
rt.put_c(10);
rt.put_n(sum(t, 4));
rt.put_c(10);
rt.put_n(sum(t, 5));
return 0;
}
|