这段代码复制到 vb6里面,read那行就报错?麻烦帮忙翻译一下。

1000 Rem This program demonstrates the IRI computation.
1010 Rem A number of recommended modifications are described in
1020 Rem the accompanying text.
1030 Rem Initialize constants
1040 Dim Y(26), Z(4), Z1(4), ST(4, 4), PR(4)
1050 READ DX
1060 K = Int(0.25 / DX + 0.5) + 1
1070 If K < 2 Then K = 2
1080 BL = (K - 1) * DX
1090 For I = 1 To 4
1100 For J = 1 To 4
1110 READ ST(I, J)
1120 Next J
1130 READ PR(I)
1140 Next I
1150 Rem Initialize variables.
1160 Input #"profile elevation 11 m from start:", Y(K)
1170 Input #"X=0.Elevation=", Y(1)
1180 Z1(1) = (Y(K) - Y(1)) / 11
1190 Z1(2) = 0
1200 Z1(3) = Z1(1)
1210 Z1(4) = 0
1220 RS = 0
1230 IX = 1
1240 I = 0
1250 Rem Loop to input profile and Calculate Roughness
1260 I = I + 1
1270 Print "X="; IX * DX,
1280 IX = IX + 1
1290 Input #"Elev.=", Y(K)
1300 Rem Compute slope input
1310 If IX < K Then Y(IX) = Y(K)
1320 If IX < K Then GoTo 1270
1330 YP = (Y(K) - Y(1)) / BL
1340 For J = 2 To K
1350 Y(J - 1) = Y(J)
1360 Next J
1370 Rem Simulate vehicle response
1380 For J = 1 To 4
1390 Z(J) = PR(J) * YP
1400 For JJ = 1 To 4
1410 Z(J) = Z(J) + ST(J, JJ) * Z1(JJ)
1420 Next JJ
1430 Next J
1440 For J = 1 To 4
1450 Zi(J) = Z(J)
1460 Next J
1470 RS = RS + Abs(Z(1) - Z(3))
1480 Print "disp="; RS * DX, "IRI="; RS / I
1490 GoTo 1260
1500 End
1510 Data 0.25
1520 Data 0.966071, 0.01091514, -0.002083274, 0.0003190145, 0.005476107
1530 Data -0.5563044, 0.9438768, -0.8324718, 0.0064701, 1.388776
1540 Data 0.02153176, 0.002126763, 0.7508714, 0.008221888, 0.2275968
1550 Data 3.335013, 0.3376467, -39.12762, 0.4347564, 35.79262
End Sub

我理解是这段代码是输入一组数据,Y(1)也是输入的,Y(K)也是输的。dx是一个变量,这个变量等于 Y(1)=4.001,Y(2)=4.004......Y(K)=4.006,输入K个数据后 得出一个最终的输出结果。大神加一下微信帮帮我,很急,vx:sohjw0812

1个回答

差得太多了,
1510 Data 0.25
1520 Data 0.966071, 0.01091514, -0.002083274, 0.0003190145, 0.005476107
1530 Data -0.5563044, 0.9438768, -0.8324718, 0.0064701, 1.388776
1540 Data 0.02153176, 0.002126763, 0.7508714, 0.008221888, 0.2275968
1550 Data 3.335013, 0.3376467, -39.12762, 0.4347564, 35.79262
这些都不能编译
需要定义一个数组,然后所有read改成数组访问。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问