问题出在哪里 清帮忙修改下
Dim num As Integer
Dim a(), b()
myfile1 = App.Path & "\" & "2.txt"
myfile2 = App.Path & "\" & "4.txt"
Open myfile1 For Input As #1
Open myfile2 For Output As #2
Line Input #1, s
Dim arr
While InStr(s, "
")
s = Replace(s, " ", " ")
Wend
arr = Split(s, " ")
For i = 0 To n
a(i) = arr(0)
b(i) = arr(1)
sum = 0
num = 0
sum = sum + a(i) * b(i)
num = num + b(i)
Next
avr = sum / num
Print "数量为:", Space(4), num
Print "价值为:", Space(4), sum
Print "平均数为:"; Space(4), avr
Close #2
Close #1
End Sub
[[it] 本帖最后由 菜鸟新上路 于 2008-11-2 11:04 编辑 [/it]]