国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > VBScript > 正文

好玩的vbs特色代碼vbs棧類

2020-03-24 18:19:36
字體:
供稿:網(wǎng)友
數(shù)據(jù)結(jié)構(gòu)的問題相當(dāng)重要,如果你能描述出一個(gè)問題的輸入和輸出數(shù)據(jù)結(jié)構(gòu),那么這個(gè)問題就大有希望,數(shù)據(jù)結(jié)構(gòu)并不是C語言的專利,真正的數(shù)據(jù)結(jié)構(gòu)是偽代碼的。下面這個(gè)棧類是我以前搜集別人的代碼,實(shí)際上每當(dāng)考慮一個(gè)程序問題的時(shí)候,尤其是復(fù)雜的程序,就應(yīng)該想到,用什么樣的數(shù)據(jù)去描述你的輸入和輸出。

'**********************************************
' vbs棧類
' push(string)進(jìn)棧
' getTop取棧頂元素
' pop去掉棧頂元素
' isempty是否棧空
' isfull是否棧滿(pMax設(shè)置了大小,可自行修改)
'
' 木鳥 2002.10.10
' http://www.aspsky.net/
'**********************************************

html' target='_blank'>class Stack
private pArr, pString, pMax
private tab
private sub class_initialize()
tab=chr(9)
pMax=1000 '最大容量
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) 1 and not Isfull then
if isarray(pArr) then
pString=join(pArr,tab)
end if
pString=pString & tab & str
pArr=split(pString,tab)
push=true
else
push=false
end if
end function

public function GetTop()
if not isarray(pArr) 0 then
GetTop=null
else
if ubound(pArr) 0 then
GetTop=null
else
GetTop=pArr(Ubound(pArr))
end if
end if
end function

public function Pop()
if not isArray(pArr) then
Pop=false
else
if Ubound(pArr) 0 then
Pop=false
else
pString=join(pArr,tab)
pString=left(pString,inStrRev(pString,tab)-1)
pArr=split(pString,tab)
Pop=true
end if
end if
end function

public function Isempty()
if not isArray(pArr) then
Isempty=true
else
if Ubound(pArr) 0 then
isempty=true
else
isempty=false
end if
end if
end function

public function Isfull()
if not isArray(pArr) then
Isfull=false
else
if ubound(pArr) pMax then
Isfull=false
else
Isfull=true
end if
end if
end function
end class
html教程

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時(shí)間聯(lián)系我們修改或刪除,多謝。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 闵行区| 新民市| 社会| 神池县| 搜索| 望城县| 呼玛县| 教育| 马尔康县| 霍城县| 湟源县| 泽州县| 武穴市| 富平县| 中西区| 和田县| 宁强县| 武隆县| 镇康县| 得荣县| 永春县| 鞍山市| 马尔康县| 武义县| 旅游| 宁河县| 中江县| 嘉黎县| 棋牌| 三原县| 博乐市| 双峰县| 大港区| 抚宁县| 宁陵县| 县级市| 巩义市| 新津县| 杭锦后旗| 荆门市| 凤冈县|