搜“vb中label控件如何同时输出一维数组和这个一维数组中的最大最小值
vb中label控件如何同时输出一维数组和这个一维数组中的最大最小值,并且最大最小值数字前要有“最大值是”,“最小值是”字样,同时一维数组输出后要自动换行,即最大最小值是...
vb中label控件如何同时输出一维数组和这个一维数组中的最大最小值,并且最大最小值数字前要有“最大值是”,“最小值是”字样,同时一维数组输出后要自动换行,即最大最小值是一位数组的下一行,
我有写个代码,求各位大神看看,在线等~~~~
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a$(5), i%, max%, min%
min = a(0)
For i = 0 To 5
a(i) = Int(Rnd() * 94 + 6)
If a(i) > max Then
max = a(i)
If a(i) < min Then
min = a(i)
End If
End If
Next
Label1.Text = a(i) + Space(1) + vbCrLf + "最大值是:" & max & Space(4) & "最小值是:" & min
End Sub 展开
我有写个代码,求各位大神看看,在线等~~~~
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a$(5), i%, max%, min%
min = a(0)
For i = 0 To 5
a(i) = Int(Rnd() * 94 + 6)
If a(i) > max Then
max = a(i)
If a(i) < min Then
min = a(i)
End If
End If
Next
Label1.Text = a(i) + Space(1) + vbCrLf + "最大值是:" & max & Space(4) & "最小值是:" & min
End Sub 展开
1个回答
展开全部
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a$(5), i%, max%, min%, s$
For i = 0 To 5
a(i) = Int(Rnd() * 94 + 6)
If a(i) > max Then max = a(i)
If a(i) < min Then min = a(i)
s = s & a(i) & " "
Next
Label1.Text = s & vbCrLf & "最大值是:" & max & Space(4) & "最小值是:" & min
End Sub
Dim a$(5), i%, max%, min%, s$
For i = 0 To 5
a(i) = Int(Rnd() * 94 + 6)
If a(i) > max Then max = a(i)
If a(i) < min Then min = a(i)
s = s & a(i) & " "
Next
Label1.Text = s & vbCrLf & "最大值是:" & max & Space(4) & "最小值是:" & min
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询