Home > Software engineering >  Very simple homework, I learn civil, really not, thanks
Very simple homework, I learn civil, really not, thanks

Time:10-07

Number 3, read the uncertainty of test scores, and determine how many scores is greater than or equal to the average, how many scores were smaller than average, said the end of the input, input - 1 when the input data needed by program control can only enter between 1 and 0 to 100 points, a dynamic array is complete,

CodePudding user response:

Their top ZIJID

CodePudding user response:

Keyboard input or input file?

CodePudding user response:

You won't learn civil is not a reason, when I read the university also learn civil, but why do many people in my class, the key is you this question, after watching the know is a very basic programming problem, in the title of the national computer level 2 test, also be normal difficult topic,

Then again, since upstairs is willing to help you advice, it still shows details as soon as possible,

CodePudding user response:

Writing code, it is the PRIvate and so on

CodePudding user response:

 Private Sub Text1_Change () 
Dim (s) As String, t () As Single, I As Long, avg As Single, n As Long
S=Split (Trim (Text1))
If UBound (s) & lt; 1 Then the Exit Sub
If Right (Text1. Text, 1)="-" Then Exit Sub
ReDim t (UBound (s))
For I=0 To UBound (s)
If Not IsNumeric (s (I)) Then MsgBox "Illegal!" : the Exit Sub
If Val (s (I)) & lt; 1 Then MsgBox "Illegal!" : the Exit Sub
If Val (s (I)) & gt; 100 Then MsgBox "Illegal!" : the Exit Sub
T (I)=Val (s (I))
Avg=avg + t (I)
Next
If s (UBound (s))="1" Then
Avg=(avg + 1)/UBound (t)
For I=0 To UBound (t) - 1
If t (I) & gt;=avg Then n=n + 1
Next
MsgBox "have" & amp; N & amp; "A fraction is greater than or equal to the average, there are" & amp; UBound (t) - n & amp; "A fraction less than average"
End the If
End Sub

CodePudding user response:

refer to fifth floor allowing response:
 Private Sub Text1_Change () 
Dim (s) As String, t () As Single, I As Long, avg As Single, n As Long
S=Split (Trim (Text1))
If UBound (s) & lt; 1 Then the Exit Sub
If Right (Text1. Text, 1)="-" Then Exit Sub
ReDim t (UBound (s))
For I=0 To UBound (s)
If Not IsNumeric (s (I)) Then MsgBox "Illegal!" : the Exit Sub
If Val (s (I)) & lt; 1 Then MsgBox "Illegal!" : the Exit Sub
If Val (s (I)) & gt; 100 Then MsgBox "Illegal!" : the Exit Sub
T (I)=Val (s (I))
Avg=avg + t (I)
Next
If s (UBound (s))="1" Then
Avg=(avg + 1)/UBound (t)
For I=0 To UBound (t) - 1
If t (I) & gt;=avg Then n=n + 1
Next
MsgBox "have" & amp; N & amp; "A fraction is greater than or equal to the average, there are" & amp; UBound (t) - n & amp; "A fraction less than average"
End the If
End Sub