Home > Software engineering >  A freshman vb great god see small white o procedures where there is a problem
A freshman vb great god see small white o procedures where there is a problem

Time:10-08

Topic is to download data files wj12. TXT to own a computer, program, the data file in 10000 number from small to large, sorting before calculating the average number of 200 to 5001 between 5001, output between 5001-5200 is higher than the average number of
Dim a (10000) As a Double
Open "F: \ wj12. TXT" For Input As # 1
For I=1 To 10000
Input # 1, a (I)
Next I
For I=1 To 9999
For j=1 To 10000 - I
If a (j) & gt; A (j + 1) Then t=a (j) : a (j)=a (j + 1) : a (j + 1)=t
Next j
Next I
For I=5001 To 5200
S=s + a (I)
Next I
Avg=s/200
Print Avg
For I=5001 To 5200
If a (I) & gt; Avg Then Print a (I)
Next I
Close All
Before practice melody: they % & gt; _<% % & gt; _<%

CodePudding user response:

What format file is?
 Dim (1 To 10000) As a Double, s As Double, Avg As a Double 
Open "F: \ wj12. TXT" For Input As # 1
For I=1 To 10000
Input # 1, a (I)
Next I
Close # 1

For I=1 To 9999
For j=I To 10000
If a (I) & gt; A Then s (j)=a (I) : a (I)=a (j) : a (j)=s
Next j
Next I

For I=5001 To 5200
S=s + a (I)
Next I
Avg=s/200
Text1. Text=Avg

S=0
For I=5001 To 5200
If a (I) & gt; Avg Then s=s + 1
Next I
Text2. Text=s

CodePudding user response:

The great spirit is TXT format

CodePudding user response:

Is to ask your text data format, such as whether each data line?
  • Related