Private Sub command1_click() Dim m(10) For k = 1 To 10 m(k) = 11 - k Next k x = 5 Print m(2 + m(x))VB的一个程序
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/28 10:46:50
Private Sub command1_click() Dim m(10) For k = 1 To 10 m(k) = 11 - k Next k x = 5 Print m(2 + m(x))VB的一个程序
Private Sub command1_click() Dim m(10) For k = 1 To 10 m(k) = 11 - k Next k x = 5 Print m(2 + m(x))
VB的一个程序
Private Sub command1_click() Dim m(10) For k = 1 To 10 m(k) = 11 - k Next k x = 5 Print m(2 + m(x))VB的一个程序
Private Sub command1_click()
Dim m(10)
For k = 1 To 10
m(k) = 11 - k
Next k
x = 5
Print m(2 + m(x))
这就是个绕弯子的程序,没什么意义,考你的理解能力的.严格的说,这个程序可能有错误,Dim m(10)应该改成Dim m(1 to 10),否则m的下标范围是m(0 to 9),m(10)=11-k会出错误.不谈这个错误,说下程序的意思:
for的循环是给m(1)到m(10)赋值,成为:
m(1)=11-1=10
m(2)=11-2=9
m(3)=11-3=8
m(4)=7
m(5)=6
m(6)=5
m(7)=4
m(8)=3
m(9)=11-9=2
m(10)=11-10=1;
然后赋值x=5
最后m(2+m(x))=m(2+m(5))=m(2+6)=m(8)=3
明白了吗?下次拜托把程序贴到内容栏里,别贴题目上太累眼神了.