主页 > 知识库 > 好玩的vbs特色代码vbs栈类

好玩的vbs特色代码vbs栈类

热门标签:外呼系统免费招代理 怎么看地图标注 广州ai电销机器人一般多少钱 合肥高德地图标注 外呼线路中继线是什么 外呼系统telrobot 百度地图标注是什么意思 深圳外呼系统收费 拉萨外呼系统业务

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

'**********************************************
'        vbs栈类
'        push(string)进栈
'        getTop取栈顶元素
'        pop去掉栈顶元素
'        isempty是否栈空
'        isfull是否栈满(pMax设置了大小,可自行修改)
'
'        木鸟  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

标签:台湾 玉林 嘉兴 六安 漳州 周口 延安 广安

巨人网络通讯声明:本文标题《好玩的vbs特色代码vbs栈类》,本文关键词  好玩,的,vbs,特色,代码,栈类,;如发现本文内容存在版权问题,烦请提供相关信息告之我们,我们将及时沟通与处理。本站内容系统采集于网络,涉及言论、版权与本站无关。
  • 相关文章
  • 下面列出与本文章《好玩的vbs特色代码vbs栈类》相关的同类信息!
  • 本页收集关于好玩的vbs特色代码vbs栈类的相关信息资讯供网民参考!
  • 推荐文章