VB程序设计高手进!!!
发布网友
发布时间:2024-10-22 09:17
我来回答
共1个回答
热心网友
时间:2024-10-22 11:02
Private Sub Command1_Click()
Cls
Randomize
Dim a(19) As Integer, sum As Integer, i As Integer, j As Integer, m As Integer
For i = 0 To 19
a(i) = Int(Rnd * 100)
Text1 = Text1 & Str(a(i))
Next
smax = 0
For i = 0 To 19
For j = 0 To 3
sum = sum + a((i + j) Mod 4)
Next j
If smax < sum Then
smax = sum
p = i
End If
Next i
For j = 0 To 3
Picture1.Print a((i + j) Mod 4);
Next j
m = a((0 + j) Mod 4) + a((1 + j) Mod 4) + a((2 + j) Mod 4) + a((3 + j) Mod 4)
Picture2.Print m;
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Picture1.Cls
Picture2.Cls
End Sub
Private Sub Command3_Click()
End
End Sub