VB 编写程序,生成10个无重复数(即互不相等)的两位随机数Private Sub Command1_Click()Dim a(10) As Integer,n As IntegerDim i As Integer,k As IntegerRandomizea(1) = Int(Rnd * 90) + 10k = 1Don=___for____if____then exit forNext iif _

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 02:41:47
VB 编写程序,生成10个无重复数(即互不相等)的两位随机数Private Sub Command1_Click()Dim a(10) As Integer,n As IntegerDim i As Integer,k As IntegerRandomizea(1) = Int(Rnd * 90) + 10k = 1Don=___for____if____then exit forNext iif _
xT]kA+Iv5o$Ц-H|YČ1a'lM)K􃶂*V"e Կ͚j"9sԩܟlFg[Ao; ;J>'np{{|ύU3:z{;8_vϦC`ae45U.

VB 编写程序,生成10个无重复数(即互不相等)的两位随机数Private Sub Command1_Click()Dim a(10) As Integer,n As IntegerDim i As Integer,k As IntegerRandomizea(1) = Int(Rnd * 90) + 10k = 1Don=___for____if____then exit forNext iif _
VB 编写程序,生成10个无重复数(即互不相等)的两位随机数
Private Sub Command1_Click()
Dim a(10) As Integer,n As Integer
Dim i As Integer,k As Integer
Randomize
a(1) = Int(Rnd * 90) + 10
k = 1
Do
n=___
for____
if____then exit for
Next i
if ___ then
k=____
a(k) = n
End If
loop ___
For i = 1 To 10
Text1 = Text1 & Str(a(i))
Next i
End Sub
帮我补充一下

VB 编写程序,生成10个无重复数(即互不相等)的两位随机数Private Sub Command1_Click()Dim a(10) As Integer,n As IntegerDim i As Integer,k As IntegerRandomizea(1) = Int(Rnd * 90) + 10k = 1Don=___for____if____then exit forNext iif _
两种方法
1 补充你的算法,
Private Sub Command1_Click()
Dim a(10) As Integer,n As Integer
Dim i As Integer,k As Integer
Randomize
a(1) = Int(Rnd * 90) + 10
k = 1
Do
n = Int(Rnd * 90) + 10
For i = 1 To 10
If a(i) = n Then Exit For
Next i
If i > 10 Then
k = k + 1
a(k) = n
End If
Loop While k < 10
For i = 1 To 10
Text1 = Text1 & Str(a(i))
Next i
End Sub
2利用集合
Private Sub Command1_Click()
Dim Zjh As New Collection
Dim Tempjh As New Collection
Dim i As Integer,k As Integer
For i = 10 To 99
Zjh.Add i
Next
For i = 1 To 10
Randomize
k = Int(Rnd() * Zjh.Count + 1)
Tempjh.Add Zjh(k)
Zjh.Remove k
Next
For i = 1 To Tempjh.Count
Text1 = Text1 & Tempjh(i)
Next
End Sub

VB 编写程序,生成10个无重复数(即互不相等)的两位随机数Private Sub Command1_Click()Dim a(10) As Integer,n As IntegerDim i As Integer,k As IntegerRandomizea(1) = Int(Rnd * 90) + 10k = 1Don=___for____if____then exit forNext iif _ 用VB编写程序,随机生成10个10~99互不相同的整数,将它们按由小到大的顺序排列起来 VB矩阵转置.编写程序将2*3的矩阵转置,即转换成3*2的矩阵. 用VB编写程序完成以下功能:随机生成10个两位整数(必须使用数组),从中去掉一个最大数和一个最小数,然后求其平均数,并在窗体上输出.(vb学得不好,) 用vb 编写程序,输出100以内所有勾股数编写程序,输出100以内所有勾股数(即满足X^2+y^2=Z^2的x、y、z组合),要求x 用VB编写程序.计算1+2+3+.+100 用VB编写一个至少30句的程序 VB编写程序,生成一个10个元素的随机整数组,数组元素的范围0-100,要求将这个数组的最大值和最小值的位置对调 VB编写一个程序:分别随机生成3 个正整数,其中一个是1 位数、1 个是2 位数、1 个是3 位数. VB编程,有一个n × m的矩阵,其各元素的值由随机函数生成(范围50~150).编写程序,找出其中最大的元素 vb编写一个程序,利用随机函数生成15个80~99之间的随机整数,输出其中的最大值与最小值 VB中要求随机产生10个在[10,30]的不同整数怎么编写程序? 用VB编写一个程序,将下面的数列延长到第50项,1,2,5,10,21,42 . 计算5!+10!VB程序 随机生成数字,计算平均值,求vb程序编码! VB程序编写:某数组有20个元素,元素的值由键盘输入,要求将前10个元素与后10个元素对换.某数组有20个元素,元素的值由键盘输入,要求将前10个元素与后10个元素对换.即第1个元素与第20个元素 帮我完成一道VB编程题!编写程序,建立并输出一个10*10的矩阵,该矩阵对角线元素为1,其余元素均为0. vb、编写程序,建立并输出一个10×10的矩阵,该矩阵对角线元素为1,其余元素均为0.