Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,56 +0,0 @@
class stack
dim tos
dim stack()
dim stacksize
private sub class_initialize
stacksize = 100
redim stack( stacksize )
tos = 0
end sub
public sub push( x )
stack(tos) = x
tos = tos + 1
end sub
public property get stackempty
stackempty = ( tos = 0 )
end property
public property get stackfull
stackfull = ( tos > stacksize )
end property
public property get stackroom
stackroom = stacksize - tos
end property
public function pop()
pop = stack( tos - 1 )
tos = tos - 1
end function
public sub resizestack( n )
redim preserve stack( n )
stacksize = n
if tos > stacksize then
tos = stacksize
end if
end sub
end class
dim s
set s = new stack
s.resizestack 10
wscript.echo s.stackempty
dim i
for i = 1 to 10
s.push rnd
wscript.echo s.stackroom
if s.stackroom = 0 then exit for
next
for i = 1 to 10
wscript.echo s.pop
if s.stackempty then exit for
next

View file

@ -1,39 +0,0 @@
' Stack Definition - VBScript
Option Explicit
Dim stack, i, x
Set stack = CreateObject("System.Collections.ArrayList")
If Not empty_(stack) Then Wscript.Echo stack.Count
push stack, "Banana"
push stack, "Apple"
push stack, "Pear"
push stack, "Strawberry"
Wscript.Echo "Count=" & stack.Count ' --> Count=4
Wscript.Echo pop(stack) & " - Count=" & stack.Count ' --> Strawberry - Count=3
Wscript.Echo "Tail=" & stack.Item(0) ' --> Tail=Banana
Wscript.Echo "Head=" & stack.Item(stack.Count-1) ' --> Head=Pear
Wscript.Echo stack.IndexOf("Apple", 0) ' --> 1
For i=1 To stack.Count
Wscript.Echo join(stack.ToArray(), ", ")
x = pop(stack)
Next 'i
Sub push(s, what)
s.Add what
End Sub 'push
Function pop(s)
Dim what
If s.Count > 0 Then
what = s(s.Count-1)
s.RemoveAt s.Count-1
Else
what = ""
End If
pop = what
End Function 'pop
Function empty_(s)
empty_ = s.Count = 0
End Function 'empty_