#include <Array.au3>
Global $ws1,$ws2,$ws3
Global $no,$no1,$no2,$no3
Dim $ws[5]
$no=MsgBox(4+0x40,"随机实验","请分布输入各种参数")
main ($no)
$ws=MsgBox(4+0x40,"随机实验","您输入的参数如:"&@CRLF&"从"&$ws1&"到"&$ws2&"的范围内取"&$ws3&"个随机数" _
&@CRLF&'选"是"输出答案,选"否"重新填写!')
Switch $ws
Case 6
MsgBox(0x40,"随机实验",$ws1&chr(32)&$ws2& chr(32)&$ws3)
;~ For $num=0 To $ws3-1
;~ $ws[$num]=Random($ws1,$ws2,1)
;~ Next
;~ _ArrayDisplay($ws)
Case 7
$ws=6
main($ws)
EndSwitch
;~ $ws[$ws3]=Random($ws1,$ws2,1)
;~ _ArrayDisplay($ws)
Func main($x)
Switch $x
Case 7
Exit
Case 6
$ws1=InputBox("随机实验","请输入取随机数的最小范围:",""," m10")
quit(@error)
$no1=StringIsInt($ws1)
While $no1=0
$ws1=InputBox("随机实验","对不起!"&@CRLF&"您输入的数不是整数"&@CRLF&"请重新输入随机数的最小范围:",""," m10")
quit(@error)
$no1=StringIsInt($ws1)
WEnd
$ws2=InputBox("随机实验","请输入取随机数的最大范围:",""," m10")
quit(@error)
$no2=StringIsInt($ws2)
While $no2=0
$ws2=InputBox("随机实验","对不起!"&@CRLF&"您输入的数不是整数"&@CRLF&"请重新输入随机数的最大范围:",""," m10")
quit(@error)
$no2=StringIsInt($ws2)
WEnd
While $ws2<=$ws1
$ws2=InputBox("随机实验","对不起!"&@CRLF&"您输入的最大范围:"&$ws2&"小于或等于最小范围:"&$ws1 _
&@CRLF&"请重新输入随机数的最大范围:",""," m10")
quit(@error)
WEnd
$ws3=InputBox("随机实验","请输入取随机数的数量(也就是取几个随机数):",""," m10")
quit(@error)
$no3=StringIsInt($ws3)
While $ws3=0
$no1=MsgBox(4+0x40+0x100,"随机实验","您确定不取随机数!"&@CRLF&'按"是"确认并退出程序,按"否"重新输入')
Switch $no1
Case 6
Exit
Case 7
$ws3=InputBox("随机实验","请输入取随机数的数量(也就是取几个随机数):",""," m10")
quit(@error)
$no3=StringIsInt($ws3)
EndSwitch
WEnd
While $no3=0
$ws3=InputBox("随机实验","对不起!"&@CRLF&"您输入的数不是整数"&@CRLF& _
"请重新输入取随机数的数量(也就是取几个随机数):",""," m10")
quit(@error)
$no3=StringIsInt($ws3)
WEnd
While $ws3<0
$ws3=InputBox("随机实验","对不起!"&@CRLF&"您输入的数"&$ws3&"小于0"&@CRLF& _
"请重新输入取随机数的数量(也就是取几个随机数):",""," m10")
quit(@error)
$no3=StringIsInt($ws3)
WEnd
EndSwitch
EndFunc
Func quit($x)
If $x=1 Then
Exit
EndIf
EndFunc
才学AU3没几天,就自己动手写了一小段代码,发现问题不少,现在还有2个没有解决