VB程序设计:随机生成10个数据,用一维数组存放(默认下标从1开始),输出数组元素于一行,将该数组元素... 20
VB程序设计:随机生成10个数据,用一维数组存放(默认下标从1开始),输出数组元素于一行,将该数组元素倒序输出于另一行,再将该数组中下标为奇数、偶数的元素分别输出于不同行...
VB程序设计:随机生成10个数据,用一维数组存放(默认下标从1开始),输出数组元素于一行,将该数组元素倒序输出于另一行,再将该数组中下标为奇数、偶数的元素分别输出于不同行。
展开
1个回答
展开全部
新建一个工程,在窗体上添加一个按钮,输入以下代码,运行点击按钮就可
Private a1&(1 To 10), a2&(1 To 10)
Private Sub Command1_Click()
Dim b1&, b2&
For b1 = 1 To 10
a1(b1) = Int(Rnd() * 100)
Print a1(b1);
Next
Print
For b1 = 10 To 1 Step -1
Print a1(b1);
Next
Print
Print "下标奇数:";
For b1 = 1 To 10 Step 2
Print a1(b1);
Next
Print
Print "下标偶数:";
For b1 = 2 To 10 Step 2
Print a1(b1);
Next
End Sub
Private a1&(1 To 10), a2&(1 To 10)
Private Sub Command1_Click()
Dim b1&, b2&
For b1 = 1 To 10
a1(b1) = Int(Rnd() * 100)
Print a1(b1);
Next
For b1 = 10 To 1 Step -1
Print a1(b1);
Next
Print "下标奇数:";
For b1 = 1 To 10 Step 2
Print a1(b1);
Next
Print "下标偶数:";
For b1 = 2 To 10 Step 2
Print a1(b1);
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询