符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
冒泡排序法:
网站建设哪家好,找创新互联建站!专注于网页设计、网站建设、微信开发、微信平台小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了大姚免费建站欢迎大家使用!
Option Explicit
Private Sub Form_Click()
Const N = 10
Dim i%, a(1 To N), m%, j%, t%
Randomize
For i = 1 To N '随机输出10个1位数
a(i) = Int(Rnd * 9 + 1)
Print a(i);
Next i
For i = 1 To N - 1 '采用冒泡排序
For j = 1 To N - 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 N '输出排序后的数字
Print a(i);
Next i
试试看:
For i = LBound(moto) To UBound(moto) - 1
For j = LBound(moto) To UBound(moto) - 1 - i
If moto(j) moto(j + 1) Then
t = moto(j)
moto(j) = moto(j + 1)
moto(j + 1) = t
End If
Next j
Next i
For i = LBound(moto) To UBound(moto)
Print moto(i);
Next i
随即产生10个0~100的数,并按从小到大排序,已经验证OK!!!
Private Sub Command1_Click()
Dim num(1 To 10) As Integer
Dim i, j, t As Integer
For i = 1 To 10
num(i) = Int((100 - 0 + 1) * Rnd + 0)
Next
For i = 1 To 10
For j = i + 1 To 10
If num(i) num(j) Then
t = num(i)
num(i) = num(j)
num(j) = t
End If
Next j
Next i
For i = 1 To 10
Print num(i)
Next
End Sub
我也是VB爱好者,以后互相学习,互相努力哦!!!^_^
如果五个号码为数组元素(1)到(5),正确的排序过程:
对于i = 1至4
对于L = 1到5 - 如果A(L)(L +1)
N = A(L)
A(L),= A(L +1)
(L +1) =
结束如果下一页l
接下来,我
能够到第一台计算机来验证结果,然后分析程序。