VB编程 求代码
定义一个10个元素的数组,随机产生10个两位数存在该数组中,显示出来,按照从大到小的顺序排序显示排序后的数组元素...
定义一个10个元素的数组,随机产生10个两位数存在该数组中,显示出来,按照从大到小的顺序排序 显示排序后的数组元素
展开
4个回答
展开全部
子Command1_Click()<br />昏暗的小号(0?9)为整数,SS为整数,我作为整数,K为整数<br />随机时间()<br />对于i = 0至9 < / S(I)= INT(RND *(99 - 10 + 1)+ 10)<br /> <br /> <br /> <br />对于i = 0至9 <br />对于k = I + 1到9 <br />如果S(I)<S(K),然后<br /> SS = S(I)<br />(I)= S(K)<br />(如果K)= SS <br /> <br /> <br />打印小号(一)<br /> <br /> <br /> <br /> END SUB
2012-12-15
展开全部
Private Sub Command1_Click()
Dim a(1 To 10) As Integer
Print "产生的随机数"
For i = 1 To 10
Randomize
a(i) = Int(90 * Rnd + 10)
Print a(i);
Next i
Print
For i = 1 To 9
For j = i + 1 To 10
If a(i) < a(j) Then
b = a(i): a(i) = a(j): a(j) = b
End If
Next j
Next i
Print "排序后的数"
For i = 1 To 10
Print a(i);
Next i
Print
End Sub
Dim a(1 To 10) As Integer
Print "产生的随机数"
For i = 1 To 10
Randomize
a(i) = Int(90 * Rnd + 10)
Print a(i);
Next i
For i = 1 To 9
For j = i + 1 To 10
If a(i) < a(j) Then
b = a(i): a(i) = a(j): a(j) = b
End If
Next j
Next i
Print "排序后的数"
For i = 1 To 10
Print a(i);
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim s(0 To 9) As Integer, ss As Integer, i As Integer, k As Integer
Randomize Time()
For i = 0 To 9
s(i) = Int(Rnd * (99 - 10 + 1) + 10)
Next
For i = 0 To 9
For k = i + 1 To 9
If s(i) < s(k) Then
ss = s(i)
s(i) = s(k)
s(k) = ss
End If
Next
Print s(i)
Next
End Sub
Dim s(0 To 9) As Integer, ss As Integer, i As Integer, k As Integer
Randomize Time()
For i = 0 To 9
s(i) = Int(Rnd * (99 - 10 + 1) + 10)
Next
For i = 0 To 9
For k = i + 1 To 9
If s(i) < s(k) Then
ss = s(i)
s(i) = s(k)
s(k) = ss
End If
Next
Print s(i)
Next
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
8
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询