Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,37 @@
'Simple Stack class
'uses a dynamic array of Variants to stack the values
'has read-only property "Size"
'and methods "Push", "Pop", "IsEmpty"
Private myStack()
Private myStackHeight As Integer
'method Push
Public Function Push(aValue)
'increase stack height
myStackHeight = myStackHeight + 1
ReDim Preserve myStack(myStackHeight)
myStack(myStackHeight) = aValue
End Function
'method Pop
Public Function Pop()
'check for nonempty stack
If myStackHeight > 0 Then
Pop = myStack(myStackHeight)
myStackHeight = myStackHeight - 1
Else
MsgBox "Pop: stack is empty!"
End If
End Function
'method IsEmpty
Public Function IsEmpty() As Boolean
IsEmpty = (myStackHeight = 0)
End Function
'property Size
Property Get Size() As Integer
Size = myStackHeight
End Property