编写一个vb程序 要求随机产生10个整数成绩[60,100]存入一维数组,并求最高分、最低分和平均值
2个回答
展开全部
Dim mArr%(1 To 10)
Private Sub Command1_Click()
Dim i%
Text1.Text = ""
For i = 1 To 10
Randomize
mArr(i) = Int(Rnd * 41) + 60
Text1.Text = Text1.Text & mArr(i) & " "
Next
End Sub
Private Sub Command2_Click()
Dim Max%, Min%, Sum%
Min = 100
For i = 1 To 10
If mArr(i) > Max Then Max = mArr(i)
If mArr(i) < Min Then Min = mArr(i)
Sum = Sum + mArr(i)
Next i
Text2.Text = Max
Text3.Text = Min
Text4.Text = Sum / 10
End Sub
Private Sub Command1_Click()
Dim i%
Text1.Text = ""
For i = 1 To 10
Randomize
mArr(i) = Int(Rnd * 41) + 60
Text1.Text = Text1.Text & mArr(i) & " "
Next
End Sub
Private Sub Command2_Click()
Dim Max%, Min%, Sum%
Min = 100
For i = 1 To 10
If mArr(i) > Max Then Max = mArr(i)
If mArr(i) < Min Then Min = mArr(i)
Sum = Sum + mArr(i)
Next i
Text2.Text = Max
Text3.Text = Min
Text4.Text = Sum / 10
End Sub
展开全部
Private Sub Command1_Click()
Dim RADNUMBER(1 To 10) As Integer
Randomize
For I = 1 To 10
RADNUMBER(I) = Rnd * 40 + 60
Next
MAX = RADNUMBER(1)
For I = 2 To 10
If RADNUMBER(I) > MAX Then
MAX = RADNUMBER(I)
End If
Next
MIN = RADNUMBER(1)
For I = 2 To 10
If RADNUMBER(I) < MIN Then
MIN = RADNUMBER(I)
End If
Next
For I = 1 To 10
RDNNUMBER.Text = RDNNUMBER.Text & " " & RADNUMBER(I)
Sum = Sum + RADNUMBER(I)
Next
ARVER.Text = Sum / 10
MAX.Text = MAX
MIN.Text = MIN
End Sub
已经调试过
Dim RADNUMBER(1 To 10) As Integer
Randomize
For I = 1 To 10
RADNUMBER(I) = Rnd * 40 + 60
Next
MAX = RADNUMBER(1)
For I = 2 To 10
If RADNUMBER(I) > MAX Then
MAX = RADNUMBER(I)
End If
Next
MIN = RADNUMBER(1)
For I = 2 To 10
If RADNUMBER(I) < MIN Then
MIN = RADNUMBER(I)
End If
Next
For I = 1 To 10
RDNNUMBER.Text = RDNNUMBER.Text & " " & RADNUMBER(I)
Sum = Sum + RADNUMBER(I)
Next
ARVER.Text = Sum / 10
MAX.Text = MAX
MIN.Text = MIN
End Sub
已经调试过
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询