【vbs】1000到9999之间有多少个各位数字不同求该VBS,谢谢

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/09 11:04:35
【vbs】1000到9999之间有多少个各位数字不同求该VBS,谢谢

【vbs】1000到9999之间有多少个各位数字不同求该VBS,谢谢
【vbs】1000到9999之间有多少个各位数字不同
求该VBS,谢谢

【vbs】1000到9999之间有多少个各位数字不同求该VBS,谢谢
dim num,c,i,bool,chr
for c=1000 to 9999
for i=1 to 3
if instr(instr(1,c,mid(c,i,1))+1,c,mid(c,i,1))0 then
bool=false
exit for
else
bool=true
end if
next
if bool then num=num+1:chr=chr & c & vbCr
next
msgbox num
msgbox chr
总共4536个
第二种方法,要简单点,.
dim num,c,i,bool,chr,arr()
for c=1000 to 9999
redim arr(10)
for i=1 to 4
if arr(mid(c,i,1))=true then
bool=false
exit for
else
arr(mid(c,i,1))=true
bool=true
end if
next
if bool then num=num+1:chr=chr & c & vbCr
next
msgbox num
msgbox chr