1、第五章(1)例 5-2 Private Sub Command1_Click()Dim sum!, n%, aver!sum = 0n = 0x = Val(InputBox(“请输入“)Do While x -9999sum = sum + xn = n + 1x = Val(InputBox(“请输入“)Loopaver = sum / nMsgBox “共输入 “ Chr(j); “=“; a(j); “;Next jEnd Sub(3)例 5-4Private Sub Command1_Click()Dim a$()Dim x(0 To 10) As Integera = Split(
2、Text1, “,“)For i = o To UBound(a)If (a(i) 0) Thenk = a(i) 10x(k) = x(k) + 1End IfNext iPrintPrint “100 分的有 :“ i * 10 + 9&; “分有:“ i * 10 + 9&; “分有:“ “人“End Sub(5)例 5-6(用穷举法 、辗转相除法两种方法 )Private Sub Command1_Click()Dim m%, n%m = Val(InputBox(“请输入第一个数 m:“)n = Val(InputBox(“请输入第二个数 n:“)If m n Then t = m: m = n: n = tFor x = m To m * nIf x Mod m = 0 And x Mod n = 0 ThenPrint “最小公倍数为 :“; xEnd Sub(6)例 5-7(7)例 5-8(8)例 5-9(9)用比较交换法对 10 个学生成绩实现从低到高排序(10)用选择法对 10 个学生成绩实现从低到高排序(11)例 5-12(12)第 136 页第 3 题(13)第 136 页第 4 题(14)第 136 页第 5 题(15)第 136 页第 7 题(16)第 136 页第 8 题(17)第 136 页第 11 题