Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Matrix-transposition/Objeck/matrix-transposition.objeck
Normal file
31
Task/Matrix-transposition/Objeck/matrix-transposition.objeck
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
bundle Default {
|
||||
class Transpose {
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
input := [[1, 1, 1, 1]
|
||||
[2, 4, 8, 16]
|
||||
[3, 9, 27, 81]
|
||||
[4, 16, 64, 256]
|
||||
[5, 25, 125, 625]];
|
||||
dim := input->Size();
|
||||
|
||||
output := Int->New[dim[0],dim[1]];
|
||||
for(i := 0; i < dim[0]; i+=1;) {
|
||||
for(j := 0; j < dim[1]; j+=1;) {
|
||||
output[i,j] := input[i,j];
|
||||
};
|
||||
};
|
||||
|
||||
Print(output);
|
||||
}
|
||||
|
||||
function : Print(matrix : Int[,]) ~ Nil {
|
||||
dim := matrix->Size();
|
||||
for(i := 0; i < dim[0]; i+=1;) {
|
||||
for(j := 0; j < dim[1]; j+=1;) {
|
||||
IO.Console->Print(matrix[i,j])->Print('\t');
|
||||
};
|
||||
'\n'->Print();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue