asp 两个数组一一对应相加
<!--#includefile="a.asp"--><!--#includefile="b.asp"--><%=ww%><br><%=wx%><br><%a=array...
<!--#include file="a.asp"-->
<!--#include file="b.asp"-->
<%=ww%><br>
<%=wx%><br>
<%
a=array(ww)
b=array(wx)
dim c()
redim c(ubound(a))
for i=0 to ubound(a)
c(i)=a(i)+b(i)
next
response.write join(c,",")
%>
得到我结果如下:
0,0,0,0,0,0,1,2,3,0,0,0
0,0,0,0,0,0,1,3,5,0,0,0
0,0,0,0,0,0,1,2,3,0,0,00,0,0,0,0,0,1,3,5,0,0,0
而不是我想要的:0,0,0,0,0,0,2,5,8,0,0,0
请问大神们 如果使他们一一相加,而不是直接连接!
注:a.asp里面的参数ww=0,0,0,0,0,0,1,2,3,0,0,0
b.asp里面的参数wx=0,0,0,0,0,0,1,3,5,0,0,0
<%
a=array(1,2,3,4,5)
b=array(1,2,3,4,5)
dim c()
redim c(ubound(a))
for i=0 to ubound(a)
c(i)=a(i)+b(i)
next
response.write join(c,",")
%>
结果为:2,4,6,8,10 展开
<!--#include file="b.asp"-->
<%=ww%><br>
<%=wx%><br>
<%
a=array(ww)
b=array(wx)
dim c()
redim c(ubound(a))
for i=0 to ubound(a)
c(i)=a(i)+b(i)
next
response.write join(c,",")
%>
得到我结果如下:
0,0,0,0,0,0,1,2,3,0,0,0
0,0,0,0,0,0,1,3,5,0,0,0
0,0,0,0,0,0,1,2,3,0,0,00,0,0,0,0,0,1,3,5,0,0,0
而不是我想要的:0,0,0,0,0,0,2,5,8,0,0,0
请问大神们 如果使他们一一相加,而不是直接连接!
注:a.asp里面的参数ww=0,0,0,0,0,0,1,2,3,0,0,0
b.asp里面的参数wx=0,0,0,0,0,0,1,3,5,0,0,0
<%
a=array(1,2,3,4,5)
b=array(1,2,3,4,5)
dim c()
redim c(ubound(a))
for i=0 to ubound(a)
c(i)=a(i)+b(i)
next
response.write join(c,",")
%>
结果为:2,4,6,8,10 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询