VB编程题,有人会做么?要详细的编程步骤!谢谢!!
展开全部
第三题么?
Private Sub Command1_Click()
Dim i As Integer, n As Integer
Dim s As String, num As Integer
Dim iTotal As Long, iAvg As Double, iMax As Long
n = Val(InputBox("您要生成多少个1-100以内的随机数?"))
For i = 1 To n
num = Int(Rnd * 100 + 1) '生成100以内的随机数
If s = "" Then s = num Else s = s & "," & num
iTotal = iTotal + num '求和
If iMax < num Then iMax = num '求最大值
Next
iAvg = iTotal / n '求平均值
MsgBox "您要求输入:" & n & "个100以内的随机数,这些数是:" & vbCrLf & s _
& vbCrLf & "最大值为:" & iMax _
& vbCrLf & "和为:" & iTotal _
& vbCrLf & "平均值为:" & iAvg
End Sub
更多追问追答
追问
你自己写的么?
追答
当然是我自己写的啊,这哪里有现成的啊!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询