注册 登录
编程论坛 ASP技术论坛

我有3个数组 怎么对应取值那-----------在线等...急

guang2356447 发布于 2010-07-29 10:17, 909 次点击
我的记录是
绿色 111 白色 象牙白                                 //这是一个数组的取值
1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4                            //这是一个数组的取值
8 16 24 32                                             //这是一个数组的取值



下面4行是我取的   但是中间的数取错啦   应该是8个1   8个2   8个3  8个4    应该怎么写

绿色    1    8
111     1    16
白色    1    24
象牙白  1    32


我的代码

for i=0 to ubound(stra)
response.Write stra(i)
next
response.Write "<br>"
'------------------------------------------------------------第一个数组的取值-----------------------------
for i=0 to ubound(stra2)
response.Write stra2(i)
next
response.Write "<br>"
'--------------------------------------------------------------第二个数组的取值---------------------------
for i=0 to ubound(stra3)
response.Write stra3(i)
next
response.Write "<br>"
'----------------------------------------------------------------第三个数组的取值-------------------------
'总的-----------------------
response.Write "<br>"
for i=0 to ubound(stra)
response.Write stra(i)
response.Write stra2(i)
response.Write stra3(i)
response.Write "<br>"
next

[ 本帖最后由 guang2356447 于 2010-7-29 11:10 编辑 ]
5 回复
#2
冰镇柠檬汁儿2010-07-29 15:21
当然是这样的结果啊,你的循环次数是stra的长度,是4,那么它就会打印stra2和stra3的前四个值,如果你想stra2同时显示8个值,那么你应在response.Write stra2(i)的时候加一层循环
for i=0 to ubound(stra)
response.Write stra(i)
    for j=0 to 8
        response.Write stra2(i * 8 + j)
    next
response.Write stra3(i)
response.Write "<br>"
next
#3
guang23564472010-07-29 15:26
好激动啊  

请你吃饭啊 冰镇柠檬汁儿

等啦一天啦

非常感谢
#4
冰镇柠檬汁儿2010-07-29 15:30
呵呵,不客气
#5
guang23564472010-07-29 16:20
问题有来啦   用你刚才的循环     循环的不正确啊

下面我的结果  怎么显示9个值啊

颜色   绿色 111 白色 象牙白
尺寸   1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4
合计   8 16 24 32

颜色:绿色
1 1 1 1 1 1 1 1 2
合计8

颜色: 111
2 2 2 2 2 2 2 2 3
合计 16

颜色: 白色
3 3 3 3 3 3 3 3 4
合计 24

颜色: 象牙白
4 4 4 4 4 4 4 4
合计 32


for i=0 to ubound(stra)
response.Write "颜色:"
response.Write stra(i)
response.Write "<br>"
'-------------------------------循环读取8个记录----------------------------------------------------------
for j=0 to 8
response.Write stra2(i * 8 + j)
next
'-----------------------------------------------------------------------------------------
response.Write "<br>"
response.Write "合计"
response.Write stra3(i)
response.Write "<br>"
next



我吧那个8改成7后  执行的结果是这样的

颜色   绿色 111 白色 象牙白
尺寸   1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4
合计   8 16 24 32

颜色:绿色
1 1 1 1 1 1 1 1
合计8
颜色: 111
1 2 2 2 2 2 2 2
合计 16
颜色: 白色
2 2 3 3 3 3 3 3
合计 24
颜色: 象牙白
3 3 3 4 4 4 4 4
合计 32
#6
jjld2010-07-29 17:11
for j=1 to 8呢?
1