ASP怎么样随机给变量赋值

来源:百度知道 编辑:UC知道 时间:2024/05/05 02:33:20
<%
a=
b=
c=
d=
e=
%>
有5个变量名a,b,c,d,e
怎么样给这5个变量赋值,
让a+b+c+d+e=30
a=<15
b=<15
c=<15
d=<15
e=<15
- -!! 我是想要a+b+c+d+e=30
不是说a+b+c+d=e

测试通过,f是和的值=30,而a,b,c,d,e取值均<=15,会有负数哦
<%
function csum(a,b,c,d,e,f)
randomize

a=int(15*rnd+1)
b=int((30-a)*rnd+1) mod 16
c=int((30-a-b)*rnd+1) mod 16
d=int((30-a-b-c)*rnd+1) mod 16
e=30-a-b-c-d
f=a+b+c+d+e
end function

call csum(a,b,c,d,e,f)

response.Write a&"+"&b&"+"&c&"+"&d&"+"&e&"="&f

%>

和VB一样的