急急急急急!!!vb编程题

来源:百度知道 编辑:UC知道 时间:2024/05/16 12:09:42
共有四道 是要考试的 很急!!!!
1.设计一个程序,求20~200的6的倍数或9的倍数的和
2.编写一个过程实现两个数的交换并在Form_click()事件中调用此过程
3.编一程序根据上网时间计算上网费用
计算方法如下
费用= 30元 小于10小时
每小时3元 10--50小时
每小时2.5元 大于等于50小时
同时为了鼓励上网 每月收费最多不超过150元
4.已知数组中有六个数,9,7,10,4,3,8 设计一个程序,对数组中的数按递增顺序排序,并显示每一轮排序后的结果

command1是第一题,3是第二题,4是第三题,2在form click 和 sub change里

Private Sub Command1_Click()
s = 0
For i = 20 To 200
If i Mod 6 = 0 Or i Mod 9 = 0 Then s = s + i
Next
Print s
End Sub

Private Sub Command3_Click()
n = InputBox("输入时间")
If n < 10 Then Print 30: Exit Sub
If n < 50 Then
s = 30 + (n - 10) * 3
Print s
Exit Sub
End If
s = 30 + 40 * 3 + (n - 50) * 2.5
If s > 150 Then s = 150
Print s

End Sub

Private Sub Command4_Click()
a = Array(9, 7, 10, 4, 3, 8)
Max = 1
For i = 0 To 4
For j = i + 1 To 5
If a(Max) < a(j) Then Max = j
Next
t = a(i): a(i) = a(Max): a(Max) = t
For j = 0 To 5
Print a(j);
Next
Print
Next

End Sub

Private Sub Form_Click()
Call change(a, b)
End Sub

Public Sub change(a, b)
t