我得到错误:
- 线路:23
- 字符:4
- 下标超出范围:“数字”
- 位于:如果 numbers(i) = a then
我用 javascript 做了这个,它可以工作,但我需要转换它。
function info(numbers)
dim numbers2(99999)
numbers3 = ""
dim low
dim high
dim mean
dim halve
total = 0
dim spaces(99999)
dim a
dim b
dim i
dim c
dim whole
dim meadian
dim mode1
dim mode2
dim intResult
dim med
x = UBound(numbers)+1
For a=0 To 999999 Step 1
For i=0 To x Step 1
if numbers(i) = a then
c = numbers(i)
numbers2 = c
numbers3 = numbers3 + c + " "
low = numbers2(0)
high = a
total = total + c
end if
Next
Next
halve = UBound(numbers2)/2
whole = UBound(numbers2)
intResult = whole Mod 2
If intResult = 0 Then
halve = halve - 0.5
median = numbers2(halve)
med = true
Else
median = (numbers2(halve1)+numbers2(halve1-1))/2
med = false
End if
mean = total / UBound(numbers)
if med = true then
msgbox(numbers3 & chr(13) & chr(13) & "Lowest: " & low & chr(13) & "Highest: " & high & chr(13) & "Total: " & total & chr(13) & "Median: " & median & chr(13))
else
msgbox(numbers3 & chr(13) & chr(13) & "Lowest: " & low & chr(13) & "Highest: " & high & chr(13) & "Total: " & total & chr(13) & "Median: " & median & " -" & numbers2(halve1) & "x" & numbers2(halve1-1) & chr(13))
end if
end function
dim q(19,291,29)
info(q)
而且,我怎样才能把 q 放在输入框中?只需询问您是否想要javascript代码。