请高手说说给我听是怎样的运算过程?谢了

来源:百度知道 编辑:UC知道 时间:2024/05/16 07:59:02
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) '定义一个数组,该数组一共有7个元素,因为数组的下标从0开始
for i=0 to 6 '让数组的下标从0循环到6,共7次;
a(i)=i+1 '对数组的每个元素进行赋值
next
for i=0 to 6 '让数组的下标从0循环到6,共7次;
count=count+a(i)+1 '对count进行求和赋值,让count的值等于count+第i数组元素的值+1
next
response.write(count) '输出count求和后的结果
%>

运行下下面的程序,你就会明白这个程序是怎么执行的了:
<%
Dim a(6)
for i=0 to 6
a(i)=i+1
Response.Write "数组a("&i&")="&a(i)&"<br>"
next
Response.Write "<br>*********************************<br><br>"
Response.Write "下面是对count进行求和赋值:<br>"
for i=0 to 6
count=count+a(i)+1
Response.Write "当a("&i&")="&a(i)&"时,count="&count&"<br>"
next
response.write("count最后的值为:"&count)
%>