3个回答
2016-01-14
展开全部
添加一个命令, 再加两个文本框,文本框1 输入你要产生的组数
按命令后则文本框2产生随机数:
下面的例子是产生1~20的, 21~46的比照一下。
Dim num() As Integer
nn = Val(TextBox1.Text)
If mm > 20 Then
MsgBox "Wrong number input, please input again"
Exit Sub
End If
ReDim num(nn) As Integer
Randomize
For i = 0 To nn - 1
aa = Int(Rnd() * 20 + 1)
num(i) = aa
If i > 0 Then
Dim flag As Boolean
Judge:
flag = False
For j = 0 To i - 1
If num(i) = num(j) Then
flag = True
num(i) = Int(Rnd() * 20 + 1)
GoTo Judge
End If
Next j
End If
Next i
For i = 0 To nn - 1
result = result & num(i) & " "
Next i
TextBox2.Text = result
End Sub
按命令后则文本框2产生随机数:
下面的例子是产生1~20的, 21~46的比照一下。
Dim num() As Integer
nn = Val(TextBox1.Text)
If mm > 20 Then
MsgBox "Wrong number input, please input again"
Exit Sub
End If
ReDim num(nn) As Integer
Randomize
For i = 0 To nn - 1
aa = Int(Rnd() * 20 + 1)
num(i) = aa
If i > 0 Then
Dim flag As Boolean
Judge:
flag = False
For j = 0 To i - 1
If num(i) = num(j) Then
flag = True
num(i) = Int(Rnd() * 20 + 1)
GoTo Judge
End If
Next j
End If
Next i
For i = 0 To nn - 1
result = result & num(i) & " "
Next i
TextBox2.Text = result
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
dim x
x="贰"
if x="贰" then x=2
x="贰"
if x="贰" then x=2
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你是要写大小写人民币转换程序吗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询