3个回答
展开全部
Dim d() As Integer
Dim i As Integer
Dim MyMax As Integer
Dim n As Integer
n = Val(InputBox("输入n!"))
ReDim d(n) As Integer
For i = 1 To n
d(i) = Val(InputBox("输入第" & i & "个数!"))
Next i
MyMax = d(1)
For i = 2 To n
If d(i) > MyMax Then MyMax = d(i)
Next i
Print MyMax
Dim i As Integer
Dim MyMax As Integer
Dim n As Integer
n = Val(InputBox("输入n!"))
ReDim d(n) As Integer
For i = 1 To n
d(i) = Val(InputBox("输入第" & i & "个数!"))
Next i
MyMax = d(1)
For i = 2 To n
If d(i) > MyMax Then MyMax = d(i)
Next i
Print MyMax
展开全部
Private Sub Command1_Click()
Dim a As Integer, b() As Integer, i As Integer, t As Integer
a = Val(InputBox("请输入要输入数字个数", , 5))
ReDim b(a - 1)
For i = 0 To UBound(b)
b(i) = Val(InputBox("输入第" & i + 1 & "个数", , Int(Rnd * 101)))
Print b(i);
If b(i) > t Then t = b(i)
Next
MsgBox "最大的数是:" & t
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim num%, i%, m%, n%
Cls
n = Val(Text1)
num = Int(Rnd * 99 + 1)'先随即一个数
Print num;
Max = num'当前他最大
Min = num'同时也最小
For i = 2 To n
num = Int(Rnd * 99 + 1)'生成其余的随机数
Print num;
If num > Max Then'大于最大
Max = num
ElseIf Min > num Then'小于最小!这里还要判断,而不是直接else
Min = num
End If
Next
Label5 = "最大值为:" & Max'不要每次都改变,在循环完成后再显示。
Label6 = "最小值为:" & Min
End Sub
Dim num%, i%, m%, n%
Cls
n = Val(Text1)
num = Int(Rnd * 99 + 1)'先随即一个数
Print num;
Max = num'当前他最大
Min = num'同时也最小
For i = 2 To n
num = Int(Rnd * 99 + 1)'生成其余的随机数
Print num;
If num > Max Then'大于最大
Max = num
ElseIf Min > num Then'小于最小!这里还要判断,而不是直接else
Min = num
End If
Next
Label5 = "最大值为:" & Max'不要每次都改变,在循环完成后再显示。
Label6 = "最小值为:" & Min
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询