VB编程(结构化程序与数组)第4题~~~求大神

 我来答
寒信HK
2014-04-29 · TA获得超过1876个赞
知道大有可为答主
回答量:1326
采纳率:92%
帮助的人:395万
展开全部
Dim a(1 To 15) As Integer

Private Sub Command1_Click()
Dim i As Integer, j As Integer, tmp As Integer
For i = 1 To 15
For j = 1 To 15 - i
If a(j) < a(j + 1) Then
tmp = a(j)
a(j) = a(j + 1)
a(j + 1) = tmp
End If
Next j, i
Print
Print "排序后的数组为:";
For i = 1 To 15
Print a(i) & " ";
Next
End Sub

Private Sub Form_Load()
Dim i As Integer
Me.AutoRedraw = True
Print "排序前的数组为";
For i = 1 To 15
Randomize
a(i) = Rnd * 89 + 10
Print a(i) & " ";
Next
End Sub
浩哥奕弟
2014-04-29 · 杂七杂八想到什么就是什么
浩哥奕弟
采纳数:381 获赞数:956

向TA提问 私信TA
展开全部

Private Sub Command1_Click()
    Dim y As String, z As String
    Dim arr(1 To 15)
    Dim i As Integer, j As Integer, T As Integer
        For i = 1 To 15
            arr(i) = Int(Rnd * 90 + 10)
            y = y & " " & arr(i)
        Next
        Print "排序前的数组为:" & y
        For i = 1 To 14
            For j = i + 1 To 15
                If arr(i) < arr(j) Then
                    T = arr(i)
                    arr(i) = arr(j)
                    arr(j) = T
                End If
            Next
            z = z & " " & arr(i)
        Next
        z = z & " " & arr(15)
        Print "从大到小排序的数组为:" & z
End Sub

追问
我错了木有看到你的,对不起啊!幸苦你了TAT
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式