VB编程题,
Private Sub comNo_1_Click()
Dim i As Integer, intSum As Integer
For i = 1 To 150 Step 2
intSum = intSum + i
Next i
Print "第1题"
Print "Sum="; intSum
End Sub
Private Sub comNo_2_Click()
Randomize (Timer)
Dim i As Integer, intArray(1 To 10) As Integer, intMax As Integer
Print "第2题"
For i = 1 To 10
intArray(i) = Int(Rnd(i) * 9 + 1)
Print intArray(i);
Next i
intMax = intArray(1)
For i = 2 To 10
If intArray(i) > intMax Then
intMax = intArray(i)
End If
Next i
Print "Max="; intMax
End Sub
2024-11-10 广告