作者bamoo (~"~)
看板Visual_Basic
标题[VB6 ] Function使用阵列问题
时间Wed Oct 8 18:09:13 2008
麻烦各位
小弟在写副程式要算其标准差
其数值存在下面的normal阵列里....
Dim normal(22) as double
Function s(ByVal x As Double, y() As Double, ByVal n As Integer) As Double
Dim sumS, ss As Double
sumS = 0
For i = 1 To n
sumS = sumS + y(i) ^ 2
Next i
ss = sqr((sumS - n * x ^ 2) / n - 1)
End Function
sN = s(avgN, normal, count1)
^^^^^^
执行错误:
『必须是阵列或是自订型态』
(avgN为平均数、count1为阵列内数字个数)
爬文後还是不太懂要怎麽正确使用
麻烦各位了@@
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.116.96.104
※ 编辑: bamoo 来自: 140.116.96.104 (10/08 18:12)
※ 编辑: bamoo 来自: 140.116.96.104 (10/08 18:18)
※ 编辑: bamoo 来自: 140.116.96.104 (10/08 18:19)
1F:→ humanfly:没用过vb6 不过vb.net里是ByVal y() As Double 10/08 21:09
2F:→ humanfly:vb2005会自动修正,而且你的function也没回传值 10/08 21:12
3F:→ humanfly:其他的话我改写成vb.net用2005没问题 10/08 21:13