VB提示下标越界:提示下面的st(j)数组下标越界。
Functiontread()DimnacAsInteger,areaAsSingleDimsumacAsSingle,nchAsIntegerReDimach(nch-...
Function tread()
Dim nac As Integer, area As Single
Dim sumac As Single, nch As Integer
ReDim ach(nch - 1) As Single, d(nch - 1) As Single
Input #3, subcat
Print #5, "subtchment :", subcat
Input #3, nac, area
For j = 0 To nac - 1
Input #3, ac(j), st(j)
Next j
For j = 0 To nac - 1
tarea = tarea + ac(j)
Next j
tl = 0
ac(0) = ac(0) / tarea
sumac = ac(0)
For j = 1 To nac - 1
ac(j) = ac(j) / tarea
sumac = sumac + ac(j)
tl = tl + ac(j) * (st(j) + st(j - 1)) / 2
Next j
ac(nac) = 0
End Function 展开
Dim nac As Integer, area As Single
Dim sumac As Single, nch As Integer
ReDim ach(nch - 1) As Single, d(nch - 1) As Single
Input #3, subcat
Print #5, "subtchment :", subcat
Input #3, nac, area
For j = 0 To nac - 1
Input #3, ac(j), st(j)
Next j
For j = 0 To nac - 1
tarea = tarea + ac(j)
Next j
tl = 0
ac(0) = ac(0) / tarea
sumac = ac(0)
For j = 1 To nac - 1
ac(j) = ac(j) / tarea
sumac = sumac + ac(j)
tl = tl + ac(j) * (st(j) + st(j - 1)) / 2
Next j
ac(nac) = 0
End Function 展开
4个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询