张翼云 计算机,5yue13hao

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

Option Base 1

Dim a#(10), b#, n#, i#, j#, m#, p#, t#

Private Sub Command1_Click()

n = LBound(a)

m = UBound(a)

For i = LBound(a) To UBound(a)

a(i) = Int(Rnd * (120 - 60 + 1) + 60)

Print a(i);

If i Mod 10 = 0 Then Print

Next i

End SubPrivate Sub Command2_Click()

n = LBound(a)

m = UBound(a)

For i = n To m

If a(n) > a(i) Then

a(n) = a(i)

End If

Next i

Print "最小值为:" & a(n)

End SubPrivate Sub Command3_Click()

n = LBound(a)

m = UBound(a)

For i = n To m - 1

p = i

For j = i + 1 To m

If a(p) > a(j) Then p = j

Next j

t = a(i): a(i) = a(p): a(p) = t

Next i

Print "选择排序后的数组为:"

For i = n To m

Print a(i);

If i Mod 10 = 0 Then Print

Next i

End SubPrivate Sub Command4_Click()

n = LBound(a)

m = UBound(a)

For i = n To m

For j = n To m - 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

Print "冒泡排序后的数组为:"

For i = n To m

Print a(i);

If i Mod 10 = 0 Then Print

Next i

End SubPrivate Sub Command5_Click()

n = LBound(a)

m = UBound(a)

For i = n To 5

t = a(i): a(i) = a(11 - i): a(11 - i) = t

Next i

Print:

For i = n To m

Print a(i);

If i Mod 10 = 0 Then Print

Next i

End SubPrivate Sub Form_Load()End Sub

.qmbox style,.qmbox script,.qmbox head,.qmbox link,.qmbox meta{display: none !important;}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值