September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 deletions

View file

@ -1,16 +1,16 @@
import extensions.
import extensions;
program =
[
var n := Integer new.
var m := Integer new.
public program()
{
var n := new Integer();
var m := new Integer();
console write:"Enter two space delimited integers:".
console readLine(n,m).
console.write:"Enter two space delimited integers:";
console.loadLine(n,m);
var myArray := RealMatrix new(n,m).
var myArray := new Matrix<int>(n,m);
myArray[0][0] := 2.
myArray.setAt(0,0,2);
console printLine(myArray[0][0]).
].
console.printLine(myArray.at(0, 0))
}

View file

@ -1,18 +1,18 @@
import system'routines.
import extensions.
import system'routines;
import extensions;
program =
[
var n := Integer new.
var m := Integer new.
public program()
{
auto n := new Integer();
auto m := new Integer();
console write:"Enter two space delimited integers:".
console readLine(n,m).
console.write:"Enter two space delimited integers:";
console.loadLine(n,m);
var myArray2 := Array new:n; populate(:i)( Array new:m ).
myArray2[0][0] := 2.
myArray2[1][0] := "Hello".
auto myArray2 := new object[][](n.Value).populate:(int i => (new object[](m.Value)) );
myArray2[0][0] := 2;
myArray2[1][0] := "Hello";
console printLine(myArray2[0][0]).
console printLine(myArray2[1][0]).
].
console.printLine(myArray2[0][0]);
console.printLine(myArray2[1][0]);
}

View file

@ -0,0 +1,14 @@
Module Program
Sub Main()
Console.WriteLine("Enter two space-delimited integers:")
Dim input = Console.ReadLine().Split()
Dim rows = Integer.Parse(input(0))
Dim cols = Integer.Parse(input(1))
' VB uses max-index for array creation.
Dim arr(rows - 1, cols - 1) As Integer
arr(0, 0) = 2
Console.WriteLine(arr(0, 0))
End Sub
End Module

View file

@ -0,0 +1,6 @@
10 INPUT "Size? ";rows;"*";columns
20 DIM a(rows,columns): REM defines a numeric array
30 LET a=INT (RND*rows)+1: LET c=INT (RND*columns+1): REM the array is labelled a, but the letter a is still available for variable assignment
40 LET a(a,c)=1
50 PRINT a(a,c)
60 DIM a(1): REM arrays cannot be removed without CLEARing the entire variable space, but redimensioning them to 1 will save most of the space they used