发布网友 发布时间:2022-04-25 17:57
共2个回答
热心网友 时间:2023-10-23 01:01
楼主没说明具体数字类型,默认当成得到任意双精度数字吧,加上了错误输入的处理,保存在.vbs中双击执行。
Dim a , b
Do
m=1
a = InputBox("please input first number:","InputBox")
If IsNumeric(a) Then
a = CDbl(a)
If a<0 Then
m = MsgBox("Please input a number more than 0!",5)
End If
Else
m = MsgBox("Please input a number more than 0!",5)
End If
If m = 2 Or m = 0 Then
WScript.Quit
End If
Loop While m=4
Do
m = 1
b = InputBox("please input second number:","InputBox")
If IsNumeric(b) Then
b = CDbl(b)
If b<0 Then
m = MsgBox("Please input a number more than 0!",5)
End If
Else
m = MsgBox("Please input a number more than 0!",5)
End If
If m = 2 Or m = 0 Then
WScript.Quit
End If
Loop While m=4
Randomize
MsgBox "The first number: "&a&vbNewLine&"The second number:"&b&vbNewLine&"The third number:"&Rnd*(a+b-(Abs(a-b)))+Abs(a-b)
热心网友 时间:2023-10-23 01:02
其实还有更好的办法,
详见:http://hi.baidu.com/qixilive/blog/item/c41865da798aa7ccb7fd4851.html