标题:我想用冒泡法把9个数从小到大排序,求好心人帮我看下下面这段小程序显示结果 ...
取消只看楼主
btt6
Rank: 2
等 级:论坛游民
帖 子:46
专家分:10
注 册:2016-8-13
结帖率:47.83%
 问题点数:0 回复次数:0 
我想用冒泡法把9个数从小到大排序,求好心人帮我看下下面这段小程序显示结果为何不正确
我想用冒泡法把9个数从小到大排序,求好心人帮我看下下面这段小程序显示结果为何不正确
Private Sub Command1_Click()
Dim a(1 To 9) As Integer
Dim i As Integer, h As Integer
For i = 1 To 9
   a(i) = InputBox("任意输入一位整数")
Next i
i = 1
h = 0
While i < 9
   If a(i) > a(i + 1) Then
      h = a(i + 1)
      a(i + 1) = a(i)
      a(i) = h
   End If
   i = i + 1
Wend
i = 1
Do
   Print a(i);
   i = i + 1
Loop Until i > 9
End Sub
2016-09-13 16:17



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-468769-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.000752 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved