Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement the vbs stack class

Shulou Source: shulou.com Published: 2022-06-03 07:18:25 10月03日 Update

This article will explain in detail how to implement the vbs stack class, Xiaobian thinks it is quite practical, so share it for everyone to make a reference, I hope you can gain something after reading this article.

The problem of data structure is very important. If you can describe the input and output data structure of a problem, then this problem is very promising. Data structure is not patented by C language. The real data structure is pseudocode. The stack class below is the code I collected from others before. In fact, whenever you think about a program problem, especially a complex program, you should think about what kind of data to describe your input and output.

'**********************************************

' vbs stack class

' push(string)

' getTop fetches the top element of the stack

' pop remove top element of stack

' isempty Is the stack empty

' isfull Whether the stack is full (pMax set the size, can be modified)

'**********************************************

class Stack

private pArr, pString, pMax

private tab

private sub class_initialize()

tab=chr(9)

pMax=1000 'maximum capacity

end sub

private sub class_terminate()

if isarray(pArr) then

erase pArr

end if

end sub

public function push(str)

if str"" and instr(str,tab)

Tags: Data data structure structure problem article code element more program input output good complex practical maximum important patent content size actual Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Redmi Apple OPPO Reno Shulou Tech Info