VB编程:产生30个两位随机整数。
答案:1 悬赏:70 手机版
解决时间 2021-02-05 02:59
- 提问者网友:最爱你的唇
- 2021-02-04 17:14
VB编程:产生30个两位随机整数。
最佳答案
- 五星知识达人网友:傲气稳了全场
- 2021-02-04 17:51
Option Explicit
Option Base 1
Private Sub Form_click()
Randomize
Dim i As Integer, j As Integer, temp As Integer
Dim a(30) As Integer
For i = 1 To 30
a(i) = Int(90 * Rnd + 10)
Next i
For i = 1 To 29
For j = i + 1 To 30
If a(i) > a(j) Then
temp = a(i)
a(i) = a(j)
a(j) = temp
End If
Next j
Next i
For i = 1 To 30
If a(i) Mod 2 <> 0 Then Print a(i):
Next i
End Sub
Option Base 1
Private Sub Form_click()
Randomize
Dim i As Integer, j As Integer, temp As Integer
Dim a(30) As Integer
For i = 1 To 30
a(i) = Int(90 * Rnd + 10)
Next i
For i = 1 To 29
For j = i + 1 To 30
If a(i) > a(j) Then
temp = a(i)
a(i) = a(j)
a(j) = temp
End If
Next j
Next i
For i = 1 To 30
If a(i) Mod 2 <> 0 Then Print a(i):
Next i
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯