vb练习题,求程序代码,窗体不用,大神们帮帮忙●v●
3个回答
展开全部
Private Sub Form_Click() '点击窗体运行
Dim i As Integer, x As Integer
Dim sum As Integer, max As Integer, min As Integer
Randonize
For i = 1 To 10
x = Int(Rnd * 50) + 50
Print x;
If i = 1 Or max < x Then max = x
If i = 1 Or min > x Then min = x
sum = sum + x
Next
Print "最大值:"; max
Print "最小值:"; min
Print "平均值:"; sum / 10
End Sub
追问
谢啦^_^
展开全部
Private Sub Command1_Click()
Dim NumberArray(10), i, sum, max, min As Integer
Dim avg As Double
sum = 0
For i = 0 To 9
Randomize
NumberArray(i) = Int((50 - 20 + 1) * Rnd + 20)
Next
min = NumberArray(0)
For i = 0 To 9
If NumberArray(i) > max Then max = NumberArray(i)
If NumberArray(i) < min Then min = NumberArray(i)
sum = NumberArray(i) + sum
Next
avg = sum / 10
Print "最大值" & max
Print "最小值" & min
Print "平均值" & avg
End Sub
追问
三克油^_^
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
uebufh当65524658htv8jydvjb689=345358ugdfbiggiYfgv卡OK呢
追问
能不能好好玩耍了。。
追答
yes
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询