Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,12 @@
PROGRAM DYNAMIC
!$DYNAMIC
DIM A%[0,0]
BEGIN
PRINT(CHR$(12);) !CLS
INPUT("Subscripts",R%,C%)
!$DIM A%[R%,C%]
A%[2,3]=6
PRINT("Value in row";2;"and col";3;"is";A%[2,3])
END PROGRAM

View file

@ -0,0 +1,11 @@
' FB 1.05.0 Win64
Dim As Integer i, j
Input "Enter two positive integers, separated by a comma"; i, j
Dim a(1 To i, 1 To j) As Integer
a(i, j) = i * j
Print "a("; Str(i); ","; Str(j); ") ="; a(i, j)
Erase a
Print
Print "Press any key to quit"
Sleep

View file

@ -0,0 +1,9 @@
import strutils, rdstdin
var
w = readLineFromStdin("Width: ").parseInt()
h = readLineFromStdin("Height: ").parseInt()
s = newSeq[seq[int]](h)
for i in 0 .. < h:
s[i].newSeq(w)

View file

@ -0,0 +1,13 @@
sequence array
integer height,width,i,j
height = floor(prompt_number("Enter height: "))
width = floor(prompt_number("Enter width: "))
array = repeat(repeat(0,width),height)
i = floor(height/2+0.5)
j = floor(width/2+0.5)
array[i][j] = height + width
printf(1,"array[%d][%d] is %d\n", {i,j,array[i][j]})

View file

@ -0,0 +1,5 @@
See 'Enter width : ' give width
See 'Enter height : ' give height
width=0+width height=0+height
aList = list(height) for x in aList x = list(width) next
aList[1][2] = 10 See aList[1][2] + nl

View file

@ -0,0 +1,10 @@
func make_matrix(x, y) {
y.of { x.of(0) };
}
var y = Sys.scanln("rows: ").to_i;
var x = Sys.scanln("cols: ").to_i;
var matrix = make_matrix(x, y); # create the matrix
matrix[y/2][x/2] = 1; # write something inside it
say matrix; # display the matrix

View file

@ -0,0 +1,19 @@
import Foundation
print("Enter the dimensions of the array seperated by a space (width height): ")
let fileHandle = NSFileHandle.fileHandleWithStandardInput()
let dims = NSString(data: fileHandle.availableData, encoding: NSUTF8StringEncoding)?.componentsSeparatedByString(" ")
if let dims = dims where dims.count == 2{
let w = dims[0].integerValue
let h = dims[1].integerValue
if let w = w, h = h where w > 0 && h > 0 {
var array = Array<[Int!]>(count: h, repeatedValue: Array<Int!>(count: w, repeatedValue: nil))
array[0][0] = 2
println(array[0][0])
println(array)
}
}

View file

@ -0,0 +1,19 @@
decl int width height
out "width: " console
set width (in int console)
out "height: " console
set height (in int console)
decl int<><> twodstream
for (decl int i) (< i height) (inc i)
append (new int<>) twodstream
end for
for (set i 0) (< i height) (inc i)
decl int j
for (set j 0) (< j width) (inc j)
append 0 twodstream<i>
end for
end for
set twodstream<0><0> 5
out twodstream<0><0> endl console

View file

@ -0,0 +1,11 @@
# A function to create an m x n matrix
# filled with the input element
def matrix(m;n):
. as $init
| ( [ range(0; n + 1) ] | map($init)) as $row
| ( [ range(0; m + 1) ] | map($row))
;
# Task: create a matrix with dimensions specified by the user
# and set the [1,2] element:
(0 | matrix($m|tonumber; $n|tonumber)) | setpath([1,2]; 99)

View file

@ -0,0 +1 @@
[[0,0,0,0],[0,0,99,0],[0,0,0,0]]