dim $unit=0,$ten=0,$hundred=0,$thousand=0
dim $digit=1
dim $num,$newnum
$num=inputbox("number","请输入一个不大于4位数的整数")
if @error=1 or $num="" Then
Exit
EndIf
Select
case $num>=0 and $num<10
$digit=1
$unit=mod($num,10)
$digit=$unit
$newnum=$unit
case $num>=10 and $num<100
$digit=2
$unit=mod($num,10)
$ten=mod(($num-$unit)/10,10)
$newnum=$unit*10+$ten
case $num>=100 and $num<1000
$digit=3
$unit=mod($num,10)
$ten=mod(($num-$unit)/10,10)
$hundred=mod(($num-$ten*10-$unit)/100,10)
$newnum=$unit*100+$ten*10+$hundred
case $num>=1000 and $num<1000
$digit=4
$unit=mod($num,10)
$ten=mod(($num-$unit)/10,10)
$hundred=mod(($num-$ten*10-$unit)/100,10)
$thousand=mod(($num-$hundred*100-$ten*10-$unit)/1000,10)
$newnum=$unit*1000+$ten*100+$hundred*10+$thousand
EndSelect
msgbox(0,"数字","这是一个"&$digit&"位数"&@crlf _
&"个位:"&$unit&@crlf&"十位:"&$ten&$ten&@crlf&"百位:"&$hundred&@crlf _
&"千位:"&$thousand&@crlf&"重组的新数:"&$newnum)
麻烦各位热心人士给个注释好吗?我快下班了。想今天上晚班之前就能消化这个东西。。。
[ 本帖最后由 laojikelly 于 2009-4-20 10:24 编辑 ] |