CodePudding user response:
Reference:Sub Test ()
Dim I As an Integer, j As an Integer, b (9) As an Integer, iMax As Integer
"' b (0)=0, b (1)=2,... This assignment
J=0 "the default position is the first
IMax=b (0) 'the default maximum
For I=1 To 9
If b (I) & gt; IMax Then
J=I "update the maximum position
IMax=b (I) 'maximum update
End the If
Next
Debug Print j, iMax 'maximum output position, value
End Sub
.
CodePudding user response:
Option Explicit
Option Base 1
Sub Main ()
Dim a (10) As an Integer
Dim iMax As Long
Dim As Long I
'generate test data'
Randomize
For I=1 To 10
A (I)=CInt (Rnd () * 100)
Debug. Print I, a (I)
Next
'to find the maximum'
IMax=1
For I=2 To 10
If a (I) & gt; A (iMax) Then
IMax=I
End the If
Next
The Debug. Print "maximum:" & amp; A (iMax) & amp; ", the subscript: "& amp; IMax
End Sub
1
42 45
3 6
April 16
5 81
6 94
7 52
August 30
9 6
10 39
Maximum value: 94, the subscript: 6
CodePudding user response:
This... Please put forward opinionsCodePudding user response:
Is there a two-word loop drops!CodePudding user response:
Writing this double loop???????CodePudding user response:
Sorry for we are studying in binary statementCodePudding user response: