vb编程两小题(thank you)
发布网友
发布时间:2022-04-23 10:09
我来回答
共1个回答
热心网友
时间:2023-10-10 22:53
1
Dim i As Long, lTemp(9) As Long, lTemp2 As Long, MaxIndex As Long, Max As Long, MinIndex As Long, Min As Long
For i = 1 To 10
Randomize
lTemp2 = Rnd * 99 + 1
lTemp(i - 1) = lTemp2
Next
lTemp2 = lTemp(0)
Max = 10
Min = 99
For i = 0 To 9
If Max < lTemp(i) Then
MaxIndex = i
Max = lTemp(i)
End If
If Min > lTemp(i) Then
MinIndex = i
Min = lTemp(i)
End If
Next
MsgBox "max is " & Max & ",index=" & MaxIndex & vbCrLf & "min is " & Min & ",index=" & MinIndex
2简单
sub delete(s1 as string,s2 as string)
s1=replace(s1,s2,"")
end sub