利用数组列表求两个数组对应下标之和,在第三个数组输出《我的方法不太正确,求更准确的解决方法》
Posted on 2006-02-21 23:32 天轰穿 阅读(747) 评论(1) 编辑 收藏 举报
<script language="vb" runat="server">
sub page_load(sender as object,e as eventargs)
dim i as integer
dim arr() as integer={1,2,3,4,5,6,7,8,9}
dim ar1() as integer={9,8,7,6,5,4,3,2,1}
dim arra as new arraylist(arr)
for i=0 to ubound(arr)
response.Write(arra(i)&"<br>")
next i
response.Write("<hr>")
dim arrb as new arraylist(ar1)
for i=0 to ubound(ar1)
response.Write(arrb(i)&"<br>")
next i
response.Write("<hr>")
dim arrc as new arraylist()
for i=0 to 8 '因为数组的下标是从0开始的,所以本来9位的,必须减去一才是实际的下标大小
arra(i)+=arrb(i)
response.Write(arra(i)&"<br>")
next i
end sub
</script>
我的思路是将两个已知数组转化成数组列表,然后在第三个数组列表中求出和,但是我怎么看这样的解决方法都有点不伦不类,所以贴出来抛砖引玉,求更好的解决方法,谢谢了!!
sub page_load(sender as object,e as eventargs)
dim i as integer
dim arr() as integer={1,2,3,4,5,6,7,8,9}
dim ar1() as integer={9,8,7,6,5,4,3,2,1}
dim arra as new arraylist(arr)
for i=0 to ubound(arr)
response.Write(arra(i)&"<br>")
next i
response.Write("<hr>")
dim arrb as new arraylist(ar1)
for i=0 to ubound(ar1)
response.Write(arrb(i)&"<br>")
next i
response.Write("<hr>")
dim arrc as new arraylist()
for i=0 to 8 '因为数组的下标是从0开始的,所以本来9位的,必须减去一才是实际的下标大小
arra(i)+=arrb(i)
response.Write(arra(i)&"<br>")
next i
end sub
</script>
我的思路是将两个已知数组转化成数组列表,然后在第三个数组列表中求出和,但是我怎么看这样的解决方法都有点不伦不类,所以贴出来抛砖引玉,求更好的解决方法,谢谢了!!