Home > Software engineering >  Ten number output maximum number and indicate the position
Ten number output maximum number and indicate the position

Time:09-26

Vb program binary ten number output maximum number and indicate the position statement

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 opinions

CodePudding 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 statement

CodePudding user response:

reference 5 floor WallesCai reply:
write this double loop???????

I think he wants to do, like:
Factory production of some products, each product in a person's hand as long as a few simple operation can be completed;
But, in the factory production process, but don't want to put the process into several working procedure, and divided the process into two workshop (or even two factory) to do,
Result is but increase the complexity of the process, but there is no cost savings, improve efficiency, it is directly caused by some "stealth" waste,


Main such idea, just "for writing code and write code",
If the teacher asked to do so, he just means he teacher don't know anything about programming, perpetuated this misunderstanding,

CodePudding user response:

Examples of binary should find a test cycle!
To find the maximum with dual cycle is SB!

CodePudding user response:

Ha ha, seems to be a typical test,

CodePudding user response:

references 9 f bcrun response:
haha, seems to be a typical test,

Is our main dual cycle test

CodePudding user response:

You and your teacher said I was optimized.
  • Related