<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      vbs(asp)的棧類

      [摘要]用js可以用array對象很容易的實現棧的功能,但在vbs中沒有相應的功能,沒辦法,只有自己動手了:(  如果你的棧不了解請查看數據結構的相關內容。這個棧類是參照c++的棧類寫的,用法一樣。用這個類...
      用js可以用array對象很容易的實現棧的功能,但在vbs中沒有相應的功能,沒辦法,只有自己動手了:(
        如果你的棧不了解請查看數據結構的相關內容。這個棧類是參照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
      %>





      日韩精品一区二区三区高清