vb操作题 改错:设有如下两组数据
问题描述:
vb操作题 改错:设有如下两组数据
A:2,8,7,6,4,28,70,25
B:79,27,32,41,57,66,78,80
编写一个程序,把上面两组数据分别赌如两个数组中,然后把两个数组中对应下表的元素相加,并把相应的结果放入第三个数组中,最后输出第三个数组的值.
我编写的程序:
Option Base 1
Private Sub Form_click()
Dim a() As Variant,b() As Variant,c() As Variant
a = Array(2,8,7,6,4,28,70,25)
b = Array(79,27,32,41,57,66,78,80)
For i = 1 To 8
c(i) = a(i) + b(i)
Print c(i);
Next i
End Sub
运行之后提示“跨界”
答
Option Base 1Private Sub Form_click()Dim a() As Variant, b() As Variant, c() As Varianta = Array(2, 8, 7, 6, 4, 28, 70, 25)b = Array(79, 27, 32, 41, 57, 66, 78, 80)ReDim c(1 To 8)For i = 1 To 8c(i) = ...