VB编程求助,下午交作业,在线等
来源:百度知道 编辑:UC知道 时间:2024/06/08 05:02:21
=.= 我是帮别人问的.他没百度帐号.我自己学的不是这个专业.
我是好小孩.哈哈~
适用于VB6:
Option Explicit
Private Sub Form_Load()
Form1.AutoRedraw = True
Dim a(10) As Long
Dim t As Long, tt As Long
Randomize
For t = 0 To 9
recreate:
a(t) = Int(Rnd * 90) + 10
For tt = 0 To t - 1
If a(t) = a(tt) Then
GoTo recreate:
End If
Next
Next
Dim max As Long, maxi As Long
For t = 0 To 9
If a(t) > max Then
max = a(t)
maxi = t
End If
Next
Form1.Print "十个数字是:"
For t = 0 To 9
Form1.Print a(t);
Next
Print
Print "最大数"; max
Print "最大数的位置"; maxi
End Sub
楼上的 jimmyfluore老兄 你测试的时候有没有注意啊 你那最大数的位子还要 +1 呢
Option  Explicit
Option  Base  1  '下标从1开始
Private  Sub  Form_Click()
        Dim  a(10)  As  Long,  i&