手机
当前位置:查字典教程网 >脚本专栏 >vbs >好玩的vbs特色代码vbs栈类
好玩的vbs特色代码vbs栈类
摘要:数据结构的问题相当重要,如果你能描述出一个问题的输入和输出数据结构,那么这个问题就大有希望,数据结构并不是C语言的专利,真正的数据结构是伪代...

数据结构的问题相当重要,如果你能描述出一个问题的输入和输出数据结构,那么这个问题就大有希望,数据结构并不是C语言的专利,真正的数据结构是伪代码的。下面这个栈类是我以前搜集别人的代码,实际上每当考虑一个程序问题的时候,尤其是复杂的程序,就应该想到,用什么样的数据去描述你的输入和输出。

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

'vbs栈类

'push(string)进栈

'getTop取栈顶元素

'pop去掉栈顶元素

'isempty是否栈空

'isfull是否栈满(pMax设置了大小,可自行修改)

'

'木鸟2002.10.10

'http://www.aspsky.net/

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

classStack

privatepArr,pString,pMax

privatetab

privatesubclass_initialize()

tab=chr(9)

pMax=1000'最大容量

endsub

privatesubclass_terminate()

ifisarray(pArr)then

erasepArr

endif

endsub

publicfunctionpush(str)

ifstr<>""andinstr(str,tab)<1andnotIsfullthen

ifisarray(pArr)then

pString=join(pArr,tab)

endif

pString=pString&tab&str

pArr=split(pString,tab)

push=true

else

push=false

endif

endfunction

publicfunctionGetTop()

ifnotisarray(pArr)<0then

GetTop=null

else

ifubound(pArr)<0then

GetTop=null

else

GetTop=pArr(Ubound(pArr))

endif

endif

endfunction

publicfunctionPop()

ifnotisArray(pArr)then

Pop=false

else

ifUbound(pArr)<0then

Pop=false

else

pString=join(pArr,tab)

pString=left(pString,inStrRev(pString,tab)-1)

pArr=split(pString,tab)

Pop=true

endif

endif

endfunction

publicfunctionIsempty()

ifnotisArray(pArr)then

Isempty=true

else

ifUbound(pArr)<0then

isempty=true

else

isempty=false

endif

endif

endfunction

publicfunctionIsfull()

ifnotisArray(pArr)then

Isfull=false

else

ifubound(pArr)<pMaxthen

Isfull=false

else

Isfull=true

endif

endif

endfunction

endclass

【好玩的vbs特色代码vbs栈类】相关文章:

好玩的vbs特色代码第1/6页

获取外网IP并发送到指定邮箱的vbs代码[已测]

用VBS实现的凯撒密码算法

进程监控实现代码[vbs+bat]

域内计算机和用户获取实现vbs代码

用vbs实现的exe2swf工具脚本代码

读取Access数据库的vbscript代码打包下载

用vbs将名称转换为正确的大小写的代码

用vbs实现更改计算机的说明的代码

TXT转HTM、HTML「TXT转网页」的vbs实现代码

精品推荐
分类导航