first commit
This commit is contained in:
commit
063194f8be
349 changed files with 36508 additions and 0 deletions
16
tester/testsuite/extensions/arrays1/array001.jl
Normal file
16
tester/testsuite/extensions/arrays1/array001.jl
Normal file
|
@ -0,0 +1,16 @@
|
|||
int main() {
|
||||
|
||||
int[] a = new int[10];
|
||||
int j=0;
|
||||
while (j<a.length) {
|
||||
a[j] = j;
|
||||
j++;
|
||||
}
|
||||
|
||||
for (int x : a)
|
||||
printInt(x);
|
||||
|
||||
int x = 45;
|
||||
printInt(x);
|
||||
return 0;
|
||||
}
|
11
tester/testsuite/extensions/arrays1/array001.output
Normal file
11
tester/testsuite/extensions/arrays1/array001.output
Normal file
|
@ -0,0 +1,11 @@
|
|||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
45
|
0
tester/testsuite/extensions/arrays1/array002.j
Normal file
0
tester/testsuite/extensions/arrays1/array002.j
Normal file
46
tester/testsuite/extensions/arrays1/array002.jl
Normal file
46
tester/testsuite/extensions/arrays1/array002.jl
Normal file
|
@ -0,0 +1,46 @@
|
|||
int [] doubleArray (int [] a){
|
||||
int [] res = new int [a . length];
|
||||
int i = 0 ;
|
||||
for (int n : a){
|
||||
res [i] = 2 * n ;
|
||||
i ++ ;
|
||||
}
|
||||
return res ;
|
||||
}
|
||||
|
||||
void shiftLeft (int [] a){
|
||||
int x = a [0];
|
||||
int i = 0 ;
|
||||
while (i < a.length - 1){
|
||||
a [i] = a [i + 1];
|
||||
i ++ ;
|
||||
}
|
||||
a[a.length - 1]= x ;
|
||||
return;
|
||||
}
|
||||
|
||||
int scalProd(int[] a, int[] b) {
|
||||
int res = 0;
|
||||
int i = 0;
|
||||
while (i < a.length) {
|
||||
res = res + a[i] * b[i];
|
||||
i++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int main () {
|
||||
int [] a = new int [5];
|
||||
int i = 0 ;
|
||||
while (i < a.length){
|
||||
a [i]= i ;
|
||||
i ++ ;
|
||||
}
|
||||
shiftLeft (a);
|
||||
int [] b = doubleArray (a);
|
||||
for (int x : a)printInt (x);
|
||||
for (int x : b)printInt (x);
|
||||
printInt(scalProd(a,b));
|
||||
return 0 ;
|
||||
}
|
||||
|
0
tester/testsuite/extensions/arrays1/array002.ll
Normal file
0
tester/testsuite/extensions/arrays1/array002.ll
Normal file
11
tester/testsuite/extensions/arrays1/array002.output
Normal file
11
tester/testsuite/extensions/arrays1/array002.output
Normal file
|
@ -0,0 +1,11 @@
|
|||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
0
|
||||
2
|
||||
4
|
||||
6
|
||||
8
|
||||
0
|
||||
60
|
Loading…
Add table
Add a link
Reference in a new issue