Matrix transposition: Difference between revisions

Line 1,331:
=2 5
=3 6</lang>
 
=={{header|Objeck}}==
<lang objeck>
bundle Default {
class Transpose {
function : Main(args : String[]) ~ Nil {
x := 4; y := 5;
m := [[1, 1, 1, 1]
[2, 4, 8, 16]
[3, 9, 27, 81]
[4, 16, 64, 256]
[5, 25, 125, 625]];
 
result := Int->New[x,y];
for(i := 0; i < x; i+=1;) {
for(j := 0; j < y; j+=1;) {
result[i,j] := m[i,j];
};
};
 
Print(result, x, y);
}
 
function : Print(matrix : Int[,], x : Int, y : Int) ~ Nil {
for(i := 0; i < x; i+=1;) {
for(j := 0; j < y; j+=1;) {
IO.Console->Print(matrix[i,j])->Print(',');
};
'\n'->Print();
};
}
}
}
</lang>
 
=={{header|OCaml}}==
760

edits