数据结构的问题相当重要,如果你能描述出一个问题的输入和输出数据结构,那么这个问题就大有希望,数据结构并不是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栈类
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新动态
- ABC唱片-《模拟万岁.立体魔声》6N纯银镀膜[WAV+CUE]
- 叶启田.1992-唱新歌·演奏畅销金曲【吉马】【WAV+CUE】
- 品冠.2004-门没锁(引进版)【滚石】【WAV+CUE】
- 万玲琳.2020-晚安,失眠的我(EP)【灵气音乐】【WAV分轨】
- 缇ゆ槦銆婄兢鏄熸瓕鏇插悎闆嗐€媅FLAC/鍒嗚建][3.1G]
- 尚雯婕《尚雯婕歌曲合集》[320K/MP3][198MB]
- 半吨兄弟《迷人烟嗓》 [WAV+CUE][527.2MB]
- 欢乐钓鱼大师锦标赛怎么玩 欢乐钓鱼大师锦标赛玩法介绍
- 欢乐钓鱼大师怎么加好友 欢乐钓鱼大师加好友方法
- 欢乐钓鱼大师鱼竿能不能重置 欢乐钓鱼大师鱼竿重置介绍
- 浩声雅韵-《2023第十八届南宁(东盟)国际视听展》珍藏版纪念CD[WAV+CUE]
- 江淑娜1996-长夜悄悄【点将】WAV+CUE
- 王馨平.1993-LINDAWONG【宝丽金】【WAV+CUE】
- 外媒玩了50小时《哈迪斯2》!称比第一部还好玩
- 陈奕迅.2013-MUSIC.LIFE精选4CD【英皇娱乐】【WAV+CUE】