冒泡排序

2011-05-12  张瑞刚 

Option Explicit
 Dim a(3),i,t,j,Data,data1
Randomize
 For i= 1 To 3
 a(i)=Int(100*rnd)
 data1=data1&a(i) & vblf
Next
  MsgBox data1
 
  For j=1 To 3
   For i=1 To 3-j
   If a(i)<a(i+1)Then
    t=a(i)
    a(i)=a(i+1)
    a(i+1)=t
   End If
   Next
  next
For i = 1 To 3
  data=data&a(i) & vblf
Next
MsgBox data
315°/3151 人阅读/0 条评论 发表评论

登录 后发表评论