2个回答
展开全部
Private Sub Command1_Click()
Dim a(1 To 10) As Integer, i As Integer, j As Integer
For i = 1 To 10 '输入十个数
a(i) = InputBox("enter data 10个数")
Print a(i);
Next i
Print
For i = 10 To 2 Step -1 '用冒泡排序法对这十个数进行排序
For j = 1 To i - 1
If a(j) > a(j + 1) Then
t = a(j): a(j) = a(j + 1): a(j + 1) = t
End If
Next j
Next i
For i = 1 To 10 '输出验证
Print a(i);
Next i
End Sub
Dim a(1 To 10) As Integer, i As Integer, j As Integer
For i = 1 To 10 '输入十个数
a(i) = InputBox("enter data 10个数")
Print a(i);
Next i
For i = 10 To 2 Step -1 '用冒泡排序法对这十个数进行排序
For j = 1 To i - 1
If a(j) > a(j + 1) Then
t = a(j): a(j) = a(j + 1): a(j + 1) = t
End If
Next j
Next i
For i = 1 To 10 '输出验证
Print a(i);
Next i
End Sub
更多追问追答
追问
输入20个数至数组中,统计其中的奇数个数和偶数的个数 谢谢
追答
你问题不是问的这个,请采纳了重新提问后我再帮你回答,本来你都没分!谢谢!
展开全部
Private Sub Form_Click()
Dim a(1 To 10) As Integer
For i = 1 To 10
a(i) = InputBox("输入")
Next i
For i = 1 To 10
p = i
For j = i + 1 To 10
If a(p) < a(j) Then p = j
Next j
t = a(i): a(i) = a(p): a(p) = t
Print a(i);
Next i
End Sub
Dim a(1 To 10) As Integer
For i = 1 To 10
a(i) = InputBox("输入")
Next i
For i = 1 To 10
p = i
For j = i + 1 To 10
If a(p) < a(j) Then p = j
Next j
t = a(i): a(i) = a(p): a(p) = t
Print a(i);
Next i
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询