VB编程:产生20个10至100间的随机整数存入一维数组A中,每行5个元素输出;定义一个4行5列的二维数组
VB编程:产生20个10至100间的随机整数存入一维数组A中,每行5个元素输出;定义一个4行5列的二维数组B,把A的前五个数存入B的第一行把A的第二组五个数存入B的第二行...
VB编程:产生20个10至100间的随机整数存入一维数组A中,每行5个元素输出;定义一个4行5列的二维数组B,把A的前五个数存入B的第一行把A的第二组五个数存入B的第二行……,输出数组B,以查看正确性。
请高手们给我代码吧,谢谢各位! 展开
请高手们给我代码吧,谢谢各位! 展开
展开全部
Private Sub Command1_Click()
Dim a(20) As Integer, b(4, 5) As Integer
Randomize
For i = 1 To 20
a(i) = Int(Rnd * 91) + 10
Print a(i);
If i Mod 5 = 0 Then Print
Next
Print
For i = 1 To 4
For j = 1 To 5
b(i, j) = a(j + (i - 1) * 5)
Print b(i, j);
Next
Print
Next
End Sub
Dim a(20) As Integer, b(4, 5) As Integer
Randomize
For i = 1 To 20
a(i) = Int(Rnd * 91) + 10
Print a(i);
If i Mod 5 = 0 Then Print
Next
For i = 1 To 4
For j = 1 To 5
b(i, j) = a(j + (i - 1) * 5)
Print b(i, j);
Next
Next
End Sub
展开全部
Private Sub Form_Load()
Dim a(1 To 20) As Integer
Dim b(1 To 4, 1 To 5) As Integer
Dim j, i As Integer
j = 1
For i = 1 To 20
Randomize
a(i) = Int(Rnd() * 90) + 10
Next i
For i = 1 To 20
k = i Mod 5
If k = 0 Then k = 5
b(j, k) = a(i)
If i Mod 5 = 0 Then j = j + 1
Next i
Print "a:"
For i = 1 To 20
Print a(i),
If i Mod 5 = 0 Then Print Chr(13)
Next i
Print "b:"
For i = 1 To 4
For j = 1 To 5
Print b(i, j),
Next j
Print
Next i
End Sub
原创哟,臭美一下
Dim a(1 To 20) As Integer
Dim b(1 To 4, 1 To 5) As Integer
Dim j, i As Integer
j = 1
For i = 1 To 20
Randomize
a(i) = Int(Rnd() * 90) + 10
Next i
For i = 1 To 20
k = i Mod 5
If k = 0 Then k = 5
b(j, k) = a(i)
If i Mod 5 = 0 Then j = j + 1
Next i
Print "a:"
For i = 1 To 20
Print a(i),
If i Mod 5 = 0 Then Print Chr(13)
Next i
Print "b:"
For i = 1 To 4
For j = 1 To 5
Print b(i, j),
Next j
Next i
End Sub
原创哟,臭美一下
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
dim i as long,A(1 to 20) as long
for i=1 to 20
A(i)=CInt(Int((100- 10+ 1) * Rnd() + 10))
next i
for i=1 to 20
A(i)=CInt(Int((100- 10+ 1) * Rnd() + 10))
next i
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询