这是我自己编写的子程序
Function VCZ(Z#) As Single '水位库容关系 Open "D:\临时文件夹\07水文\毕业设计\新程序\水位库容关系.txt" For Input As #3 For i = 1 To 65 Input #3, Hm(i), Vm(i) X2(i) = Hm(i): Y2(i) = Vm(i) Next i Close #3 Select Case Z If Z = 1076 Then VCZ = Y2(1) End If For i = 2 To 65 Case X2(i - 1) To X2(i) VCZ = (Y2(i) - Y2(i - 1)) * (Z - X2(i - 1)) / (X2(i) - X2(i - 1)) + Y2(i - 1) Next i End Select End Function
Function VCZ(Z#) As Single '水位库容关系 Open "D:\临时文件夹\07水文\毕业设计\新程序\水位库容关系.txt" For Input As #3 For i = 1 To 65 Input #3, Hm(i), Vm(i) X2(i) = Hm(i): Y2(i) = Vm(i) Next i Close #3 Select Case Z If Z = 1076 Then VCZ = Y2(1) End If For i = 2 To 65 Case X2(i - 1) To X2(i) VCZ = (Y2(i) - Y2(i - 1)) * (Z - X2(i - 1)) / (X2(i) - X2(i - 1)) + Y2(i - 1) Next i End Select End Function