Dim a, b As Integer '定义两个整型变量
a = Val(Text1.Text) '将Text1中的内容转换为数值并存入变量a
b = Val(Text2.Text) '将Text2中的内容转换为数值并存入变量b
For i = 1 To 10 '外层循环1到10
For j = 1 To 10 '内层循环1到10
nulti(i, j) = j '给数组赋值
Next
Next
MsgBox "指定数的值为:" &nulti(a, b) '输出指定数组的值
第一次外层循环:
nulti(1, 1) =1
nulti(1, 2) =2
nulti(1, 3) =3
nulti(1, 4) =4
nulti(1, 5) =5
……
nulti(1, 10) =10
第二次外层循环:
nulti(2, 1) =1
nulti(2, 2) =2
nulti(2, 3) =3
nulti(2, 4) =4
nulti(2, 5) =5
……
nulti(2, 10) =10
第三次
第四次
……
第十次
nulti(10, 1) =1
nulti(10, 2) =2
nulti(10, 3) =3
nulti(10, 4) =4
nulti(10, 5) =5
……
nulti(10, 10) =10
最后输出nulti(a, b)
比如你文本框里的值是text1.Text=2,text2.Text=3
那么输入的就是nulti(2, 3)
也就是:3
Dim nulti(1 To 10, 1 To 10) As Integer
multi(i, j) = j
multi(a, b)
两个命名写错了吧?
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)