我要编写一个程序来合并两个已经按照升序排列好的数组
例如数组A: 1,2,3,5,9,11,16,18
数组B: 4,5,6,7,8,10,12,15,17,19,21,23
需要用到三个List的控件
我是初学,很多东西不会弄
希望高手来帮帮我啊!
谢谢lairice的回答补充,我还想问一下该怎么解决c(j)=b(j-i) 这一句的下标越界问题呢?
用VB怎么合并数组?高手来救我呀!!!
答案:2 悬赏:70
解决时间 2021-03-22 18:29
- 提问者网友:紫柔同归
- 2021-03-22 03:39
最佳答案
- 二级知识专家网友:我们只是兮以城空
- 2021-03-22 04:37
dim C()
dim I as integer,J as Integer
redim C(ubound(A)+ubound(B))
for i=0 to Ubound(A)
c(i)=A(i)
next
for j=i to Ubound(b+i)
c(j)=b(j-i)
next
=========================
输入错误,应该是for j=i to Ubound(b)+i
=========================
redim C(ubound(A)+ubound(B)+1)
dim I as integer,J as Integer
redim C(ubound(A)+ubound(B))
for i=0 to Ubound(A)
c(i)=A(i)
next
for j=i to Ubound(b+i)
c(j)=b(j-i)
next
=========================
输入错误,应该是for j=i to Ubound(b)+i
=========================
redim C(ubound(A)+ubound(B)+1)
全部回答
- 1楼网友:社会水太深
- 2021-03-22 05:30
我帮你改了一下:
public state as boolean
private sub command1_click()
if state = true then
shape1.backcolor = vbwhite
state = false
else
shape1.backcolor = vbblack
state = true
end if
end sub
private sub form_load()
state = 1
shape1.backstyle = 1
shape1.backcolor = vbblack
end sub
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯