十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
不知道是哪里的恶心题目,你这里的a1,a2...没什么直接联系,所以要实现合并要写1000个循环代码!
邹城网站建设公司成都创新互联,邹城网站设计制作,有大型网站制作公司丰富经验。已为邹城1000+提供企业网站建设服务。企业网站搭建\外贸网站建设要多少钱,请找那个售后服务好的邹城做网站的公司定做!
1、定义
dim b1(1 to 1000,1 to 30)
第一行:
for i=1 to 30
b1(1,i)=a1(i)
next
复制上面的循环999次
2、定义
dim b2(1 to 30000)
第一行:
for i=1 to 30
b2(i)=a1(i)
next
第二行:
for i=1 to 30
b2(30+i)=a2(i)
next
复制上面的循环998次(稍作修改)
仅供参考,如果原始数据不是数组,建议从原始数据入手
Private Sub RowAdd() '这里以一个为例,多个自己添加就可以了
If DataGridView1.RowCount 0 Then '行数是否大于1
For Each dr As DataGridViewRow In DataGridView1.Rows
Dim ds As Object() = New Object(dr.Cells.Count - 1) {} '根据单元格个数创建数据
For i = 0 To dr.Cells.Count - 1
ds(i) = dr.Cells(i).Value '给数组赋值
Next
DataGridView7.Rows.Add(ds) '获得的值新增行
Next
End If
End Sub
Private Sub Command1_Click()
a = Array(1, 2, 4, 7, 9, 34, 65, 73, 78, 99, 234, 1234)
b = Array(0, 23, 33, 56, 78, 98, 99, 234, 1000, 9999)
Dim c(30)
i = 0
j = 0
k = 0
While i = UBound(a) And j = UBound(b)
If a(i) b(j) Then
c(k) = a(i)
i = i + 1
Else
c(k) = b(j)
j = j + 1
End If
k = k + 1
Wend
While i UBound(a)
c(k) = a(i)
i = i + 1: k = k + 1
Wend
While j UBound(b)
c(k) = b(j)
j = j + 1: k = k + 1
Wend
Print "原A数组:"
For i = 0 To UBound(a)
Print a(i);
Next i
Print "原B数组:"
For i = 0 To UBound(b)
Print b(i);
Next i
Print "合并后的c数组:"
For i = 0 To k
Print c(i);
If i Mod 15 = 14 Then Print
Next i
End Sub