vb程序 单击生数组按钮 随机生成10个65~90之间的整数存于数组a中,并显示在text1中,元素用空格隔开
vb程序单击生数组按钮随机生成10个65~90之间的整数存于数组a中,并显示在text1中,元素用空格隔开单击最大值按钮将这十个数中最大值显示在text2中并以此作为AS...
vb程序 单击生数组按钮 随机生成10个65~90之间的整数存于数组a中,并显示在text1中,元素用空格隔开 单击最大值按钮 将这十个数中最大值显示在text2中 并以此作为ASCII码 将其对应字符显示在text3中
展开
1个回答
展开全部
Dim a(1 To 10) As String
Private Sub Command1_Click() '生数组按钮
Dim i As Integer
For i = 1 To 10
Randomize
a(i) = Int((90 - 66) * Rnd + 65)
Next
Text1 = Join(a, " ")
End Sub
Private Sub Command2_Click() '最大值按钮
Dim i As Integer, i1 As Integer
For i = 1 To 9
For i1 = i + 1 To 10
If a(i) < a(i1) Then b = a(i): a(i) = a(i1): a(i1) = b
Next
Next
Text2 = a(1)
Text3 = Chr(a(1))
End Sub
请参考采纳!谢谢!
Private Sub Command1_Click() '生数组按钮
Dim i As Integer
For i = 1 To 10
Randomize
a(i) = Int((90 - 66) * Rnd + 65)
Next
Text1 = Join(a, " ")
End Sub
Private Sub Command2_Click() '最大值按钮
Dim i As Integer, i1 As Integer
For i = 1 To 9
For i1 = i + 1 To 10
If a(i) < a(i1) Then b = a(i): a(i) = a(i1): a(i1) = b
Next
Next
Text2 = a(1)
Text3 = Chr(a(1))
End Sub
请参考采纳!谢谢!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询