利用VB6.0。单机按钮Command1时生成20个(0,100)之间的随机整数,存于数组中20个0到100的随机整数,存于数
利用VB6.0。单机按钮Command1时生成20个(0,100)之间的随机整数,存于数组中20个0到100的随机整数,存于数组中,打印数组中大于50小于90的数,并球这...
利用VB6.0。单机按钮Command1时生成20个(0,100)之间的随机整数,存于数组中20个0到100的随机整数,存于数组中,打印数组中大于50小于90的数,并球这些数的和。
已有部分提示:
Private Sub Command1_Click()
Dim arr(1 To 20)
For i = 1 To 20
arr(i) = Int(Rnd * (100 - 0 + 1) + 0)
Text1.Text = Text1.Text & Chr(13) & Chr(10)
Next i
Sum = 0
for each x
..................................................... 展开
已有部分提示:
Private Sub Command1_Click()
Dim arr(1 To 20)
For i = 1 To 20
arr(i) = Int(Rnd * (100 - 0 + 1) + 0)
Text1.Text = Text1.Text & Chr(13) & Chr(10)
Next i
Sum = 0
for each x
..................................................... 展开
2个回答
展开全部
Private Sub Command1_Click()
Dim arr(1 To 20)
Text1 = "20数组元素为:" & vbCrLf
For i = 1 To 20
arr(i) = Int(Rnd * (100 - 0 + 1) + 0)
Text1.Text = Text1.Text & arr(i) & " " 'Chr(10) & Chr(13)
Next i
Sum = 0
Text1 = Text1 & vbCrLf & "数组中大于50小于90的数有:" & vbCrLf
For Each x In arr
If x > 50 And x < 90 Then Text1 = Text1 & x & " ": Sum = Sum + x
Next
Text1 = Text1 & vbCrLf & "这些数的和为:" & Sum
End Sub
Dim arr(1 To 20)
Text1 = "20数组元素为:" & vbCrLf
For i = 1 To 20
arr(i) = Int(Rnd * (100 - 0 + 1) + 0)
Text1.Text = Text1.Text & arr(i) & " " 'Chr(10) & Chr(13)
Next i
Sum = 0
Text1 = Text1 & vbCrLf & "数组中大于50小于90的数有:" & vbCrLf
For Each x In arr
If x > 50 And x < 90 Then Text1 = Text1 & x & " ": Sum = Sum + x
Next
Text1 = Text1 & vbCrLf & "这些数的和为:" & Sum
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询