How to resolve the algorithm Create a two-dimensional array at runtime step by step in the zkl programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Create a two-dimensional array at runtime step by step in the zkl programming language
Table of Contents
Problem Statement
Get two integers from the user, then create a two-dimensional array where the two dimensions have the sizes given by those numbers, and which can be accessed in the most natural way possible. Write some element of that array, and then output that element. Finally destroy the array if not done by the language itself.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Create a two-dimensional array at runtime step by step in the zkl programming language
Source code in the zkl programming language
rows:=ask("Rows: ").toInt();
cols:=ask("columns: ").toInt();
array:=rows.pump(List.createLong(rows),List.createLong(cols,0).copy);
array[1][2]=123;
array.println();
array[1][2].println();
var [const] GSL=Import("zklGSL"); // libGSL (GNU Scientific Library)
rows:=ask("Rows: ").toInt();
cols:=ask("columns: ").toInt();
m:=GSL.Matrix(rows,cols);
m[1,2]=123;
m.format().println();
println(m[1,2]);
You may also check:How to resolve the algorithm Sorting algorithms/Comb sort step by step in the Tcl programming language
You may also check:How to resolve the algorithm String interpolation (included) step by step in the M2000 Interpreter programming language
You may also check:How to resolve the algorithm Sort an integer array step by step in the E programming language
You may also check:How to resolve the algorithm Prime decomposition step by step in the Eiffel programming language
You may also check:How to resolve the algorithm Benford's law step by step in the JavaScript programming language