最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

好玩的vbs特色代碼vbs棧類

 更新時間:2007年03月08日 00:00:00   作者:  

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

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

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

相關(guān)文章

最新評論

抚州市| 通海县| 灵寿县| 东乡县| 祁门县| 岗巴县| 靖远县| 叙永县| 左权县| 霍州市| 维西| 前郭尔| 龙胜| 黄石市| 仙游县| 成都市| 武鸣县| 成安县| 雅安市| 黑山县| 镇安县| 云和县| 贵州省| 读书| 新营市| 宣武区| 盱眙县| 洪洞县| 颍上县| 综艺| 南充市| 长沙市| 南昌市| 湘阴县| 麟游县| 兴城市| 江阴市| 娄底市| 苗栗县| 佳木斯市| 罗源县|