数组A{1,3,5,8,10,12}数组B{2,4,6,7,9,11,13,15},使两个有序数列合并,并依然有序,求vb代码
展开全部
Private Sub Command1_Click()
Dim a(), b(), c%(13), t%
a = Array(1, 3, 5, 8, 10, 12)
b = Array(2, 4, 6, 7, 9, 11, 13, 15)
For i = 0 To 5
c(i) = a(i)
Next i
For j = 0 To 7
c(6 + j) = b(j)
Next j
For i = 0 To 12
For j = 0 To 12 - i
If c(j) > c(j + 1) Then
t = c(j): c(j) = c(j + 1): c(j + 1) = t
End If
Next j
Next i
For i = 0 To 13
Print c(i);
Next i
End Sub
Dim a(), b(), c%(13), t%
a = Array(1, 3, 5, 8, 10, 12)
b = Array(2, 4, 6, 7, 9, 11, 13, 15)
For i = 0 To 5
c(i) = a(i)
Next i
For j = 0 To 7
c(6 + j) = b(j)
Next j
For i = 0 To 12
For j = 0 To 12 - i
If c(j) > c(j + 1) Then
t = c(j): c(j) = c(j + 1): c(j + 1) = t
End If
Next j
Next i
For i = 0 To 13
Print c(i);
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |