Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
|
|
@ -0,0 +1,14 @@
|
|||
write "Number of rows: "
|
||||
nrows = number input
|
||||
print nrows
|
||||
write "Number of columns: "
|
||||
ncols = number input
|
||||
print ncols
|
||||
#
|
||||
len a[][] nrows
|
||||
for i to nrows
|
||||
len a[i][] ncols
|
||||
.
|
||||
a[1][1] = 11
|
||||
print a[1][1]
|
||||
len a[][] 0
|
||||
|
|
@ -5,7 +5,7 @@ public program()
|
|||
var n := new Integer();
|
||||
var m := new Integer();
|
||||
|
||||
console.write:"Enter two space delimited integers:";
|
||||
console.write("Enter two space delimited integers:");
|
||||
console.loadLine(n,m);
|
||||
|
||||
var myArray := class Matrix<int>.allocate(n,m);
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ public program()
|
|||
auto n := new Integer();
|
||||
auto m := new Integer();
|
||||
|
||||
console.write:"Enter two space delimited integers:";
|
||||
console.write("Enter two space delimited integers:");
|
||||
console.loadLine(n,m);
|
||||
|
||||
auto myArray2 := new object[][](n.Value).populate:(int i => (new object[](m.Value)) );
|
||||
auto myArray2 := new object[][](n.Value).populate::(int i => (new object[](m.Value)) );
|
||||
myArray2[0][0] := 2;
|
||||
myArray2[1][0] := "Hello";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,12 @@
|
|||
use IO;
|
||||
class TwoDimArray {
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
rows := Standard->ReadLine()->ToInt();
|
||||
cols := Standard->ReadLine()->ToInt();
|
||||
|
||||
bundle Default {
|
||||
class TwoDee {
|
||||
function : Main(args : System.String[]) ~ Nil {
|
||||
DoIt();
|
||||
}
|
||||
|
||||
function : native : DoIt() ~ Nil {
|
||||
Console->GetInstance()->Print("Enter x: ");
|
||||
x := Console->GetInstance()->ReadString()->ToInt();
|
||||
|
||||
Console->GetInstance()->Print("Enter y: ");
|
||||
y := Console->GetInstance()->ReadString()->ToInt();
|
||||
|
||||
if(x > 0 & y > 0) {
|
||||
array : Int[,] := Int->New[x, y];
|
||||
array[0, 0] := 2;
|
||||
array[0, 0]->PrintLine();
|
||||
};
|
||||
if(rows > 0 & cols > 0) {
|
||||
array := Float->New[rows, cols];
|
||||
array[0,0] := 42.0;
|
||||
Standard->Print("The number at place [0,] is: ")->PrintLine(array[0,0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue