vb编程
输入0~100的数a,再随机产生一个数b.如果a>b则输出好,否则输出否 --------------------编程问答--------------------Private Sub Form_Load()--------------------编程问答-------------------- Private Sub Form_Load()
Dim a%, b%
a = InputBox("输入0~100的数")
Randomize
b = 100 * Rnd
MsgBox IIf(a > b, "好", "否")
End Sub
Dim a%, b%
a = InputBox("输入0~100的数")
Randomize
b = 100 * Rnd
MsgBox IIf(a > b, "好", "否")
End Sub
--------------------编程问答--------------------
Private Sub Form_Load()--------------------编程问答--------------------
Dim a%, b%
a = -1
while a >=0 and a <= 100
a = InputBox("输入0~100的数")
wend
Randomize
b = 100 * Rnd
MsgBox IIf(a > b, "好", "否")
End Sub
Private Sub Form_Load()--------------------编程问答-------------------- if text1>rnd*100 then
Dim a%, b%
a = -1
while a < 0 or a > 100
a = InputBox("输入0~100的数")
wend
Randomize
b = 100 * Rnd
MsgBox IIf(a > b, "好", "否")
End Sub
msgbox "OK"
else
msgbox "NO"
endif
--------------------编程问答--------------------
Private Sub Command1_Click()
Dim a&
Do
a = InputBox("输入0~100的数")
Loop While (a < 0 Or a > 100)
Randomize
MsgBox Mid$("好否", 2 + (a > 100 * Rnd()), 1)
End Sub
--------------------编程问答-------------------- google 一下吧。现成得很多。 --------------------编程问答-------------------- Private Sub command1_click()
Dim a as integer
dim b as integer
a = InputBox("输入0~100的数")
Randomize ‘随机发生器,筛选出不同的随机数
b = int(100 * Rnd) '给产生的随机数赋整
MsgBox IIf(a > b, "好", "否")
End Sub --------------------编程问答-------------------- Randomize '随机发生器,筛选出不同的随机数
请问这句话有啥用 感觉去掉没啥影响呀 随机数还是不同呀!
补充:VB , 基础类