gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
applied GPL to sources in src
[mjc2wsl.git] / samples / sample.mj
1 program P
2 final int size = 10;
3 class Table {
4 int[] pos;
5 int[] neg;
6 }
7 Table val;
8 {
9 void main()
10 int x, i;
11 { //---------- Initialize val
12 val = new Table;
13 val.pos = new int[size]; val.neg = new int[size];
14 i = 0;
15 while (i < size) {
16 val.pos[i] = 0; val.neg[i] = 0;
17 i++;
18 }
19 //---------- Read values
20 read(x);
21 while (x != 0) {
22 if (0 <= x && x < size) {
23 val.pos[x]++;
24 } else if (-size < x && x < 0) {
25 val.neg[-x]++;
26 }
27 read(x);
28 }
29 }
30 }
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner