我是ASP新手啊,请大家帮忙解释一下下面代码为什么运行结果是:35 (请解释详细一点...)
Dim a(6)
for i=0 to 6
a(i)=i+1
next
for i=0 to 6
count=count+a(i)+1
next
response.write count
我是ASP新手啊,请大家帮忙解释一下下面代码为什么运行结果是:35 (请解释详细一点...)
Dim a(6)
for i=0 to 6
a(i)=i+1
next
for i=0 to 6
count=count+a(i)+1
next
response.write count
Dim a(6) //定义一个数组变量,a(6)
for i=0 to 6 //for语句,循环0到6
a(i)=i+1 //i+1付值给a(i)
next
for i=0 to 6
count=count+a(i)+1 //count+a(i)+1付值给变量count
next
response.write count //输出变量count
因为是for循环,
for i=0 to 6
a(i)=i+1 a(i)是1,2,3,4,5,6
for i=0 to 6
count=count+a(i)+1
count=2,3,4,5,6,7,8
循环加下2+3+4+5+6+7+8=35