Family Day update
This commit is contained in:
parent
aac6731f2c
commit
9ad63ea473
2442 changed files with 39761 additions and 8255 deletions
|
|
@ -0,0 +1,7 @@
|
|||
10 INPUT "ENTER TWO INTEGERS:"; X%, Y%
|
||||
20 DIM A%(X% - 1, Y% - 1)
|
||||
30 X% = RND(1) * X%
|
||||
40 Y% = RND(1) * Y%
|
||||
50 A%(X%, Y%) = -32767
|
||||
60 PRINT A%(X%, Y%)
|
||||
70 CLEAR
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
10 PRINT "1ST DIMENSION: ";
|
||||
20 INPUT D1
|
||||
30 PRINT D1
|
||||
40 PRINT "2ND DIMENSION: ";
|
||||
50 INPUT D2
|
||||
60 PRINT D2
|
||||
70 DIM A(D1,D1)
|
||||
80 PRINT "ARRAY CREATED"
|
||||
90 LET X=1+INT (D1*RND)
|
||||
100 LET Y=1+INT (D2*RND)
|
||||
110 LET A(X,Y)=37
|
||||
120 PRINT "ITEM ";X;", ";Y;" = ";A(X,Y)
|
||||
130 CLEAR
|
||||
140 PRINT "ARRAY DESTROYED"
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Input "ROWS? ",R
|
||||
Input "COLS? ",C
|
||||
{R,C}→dim([A])
|
||||
42→[A](1,1)
|
||||
Disp [A](1,1)
|
||||
DelVar [A]
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
INPUT "Enter array dimensions separated by a comma: " a%, b%
|
||||
|
||||
DIM array(a%, b%)
|
||||
array(1, 1) = PI
|
||||
PRINT array(1, 1)
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
10 print chr$(147);chr$(14);
|
||||
15 print "Size of array:"
|
||||
20 print "Columns (1-20)";:input x%
|
||||
25 if x%<1 or x%>20 then print "Try again.":goto 20
|
||||
30 print "Rows (1-20)";:input y%
|
||||
35 if y%<1 or y%>20 then print "Try again.":goto 30
|
||||
40 x%=x%-1:y%=y%-1:dim a$(x%,y%)
|
||||
50 nx=int(rnd(1)*x%):ny=int(rnd(1)*y%)
|
||||
60 a$(nx,ny)="X"
|
||||
70 print "Element";nx;",";ny;"= '";a$(nx,ny);"'"
|
||||
80 clr:rem clear variables from ram
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
100 INPUT PROMPT "Enter array dimensions separated by a coma: ":A,B
|
||||
110 NUMERIC ARRAY(1 TO A,1 TO B)
|
||||
120 LET ARRAY(1,1)=PI
|
||||
130 PRINT ARRAY(1,1)
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
input "Enter first array dimension "; a
|
||||
input "Enter second array dimension "; b
|
||||
|
||||
dim array( a, b)
|
||||
|
||||
array( 1, 1) = 123.456
|
||||
print array( 1, 1)
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
If OpenConsole()
|
||||
Define x, y
|
||||
|
||||
Print("Input X-Size: ")
|
||||
x = Val(Input())
|
||||
|
||||
Print("Input Y-Size: ")
|
||||
y = Val(Input())
|
||||
|
||||
Dim a(x,y) ; Should really check if x & y are larger then 1, but that would be less fun....
|
||||
|
||||
a(1,1)=Random(1000)
|
||||
PrintN("a(1,1)= " + Str(a(1,1)) )
|
||||
|
||||
PrintN("Press ENTER to exit"):Input()
|
||||
End ; Close down and let PureBasic delete the Console and all variables.
|
||||
EndIf
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
print "Enter array 1 greater than 0"; : input a1
|
||||
print "Enter array 2 greater than 0"; : input a2
|
||||
|
||||
dim chrArray$(max(a1,1),max(a2,1))
|
||||
dim numArray(max(a1,1),max(a2,1))
|
||||
|
||||
chrArray$(1,1) = "Hello"
|
||||
numArray(1,1) = 987.2
|
||||
print chrArray$(1,1);" ";numArray(1,1)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
width = int(raw_input("Width of myarray: "))
|
||||
height = int(raw_input("Height of Array: "))
|
||||
myarray = [[0] * width for i in xrange(height)]
|
||||
myarray = [[0] * width for i in range(height)]
|
||||
myarray[0][0] = 3.5
|
||||
print myarray[0][0]
|
||||
print (myarray[0][0])
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
myarray = {(w,h): 0 for w in range(width) for h in range(height)}
|
||||
# or, in pre 2.7 versions of Python: myarray = dict(((w,h), 0) for w in range(width) for h in range(height))
|
||||
myarray[(0,0)] = 3.5
|
||||
print myarray[(0,0)]
|
||||
print (myarray[(0,0)])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue