VB有序数组A中过程
答案:1 悬赏:0 手机版
解决时间 2021-01-05 17:11
- 提问者网友:藍了天白赴美
- 2021-01-05 06:56
VB有序数组A中过程
最佳答案
- 五星知识达人网友:孤独入客枕
- 2021-01-05 08:21
Private Sub Form_Click()
Dim a(8) As Integer
Dim temp As Integer
a(1) = 2
a(2) = 3
a(3) = 6
a(4) = 8
a(5) = 9
a(6) = 12
a(7) = 14
a(8) = 19
For i = 1 To 8
Print a(i);
Next i
Dim b(9) As Integer
For i = 1 To 8
b(i) = a(i)
Next i
b(9) = 10
For i = 1 To 9
For j = 1 To 9 - i
If a(j) > b(j + 1) Then
temp = b(j + 1)
b(j + 1) = b(j)
b(j) = temp
End If
Next j
Next i
Print
For i = 1 To 9
Print b(i);
Next i
End Sub
Dim a(8) As Integer
Dim temp As Integer
a(1) = 2
a(2) = 3
a(3) = 6
a(4) = 8
a(5) = 9
a(6) = 12
a(7) = 14
a(8) = 19
For i = 1 To 8
Print a(i);
Next i
Dim b(9) As Integer
For i = 1 To 8
b(i) = a(i)
Next i
b(9) = 10
For i = 1 To 9
For j = 1 To 9 - i
If a(j) > b(j + 1) Then
temp = b(j + 1)
b(j + 1) = b(j)
b(j) = temp
End If
Next j
Next i
For i = 1 To 9
Print b(i);
Next i
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯