home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frm7_1_4
- Caption = "Exam Analysis"
- ClientHeight = 2028
- ClientLeft = 2856
- ClientTop = 1512
- ClientWidth = 3264
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 7.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 2028
- ScaleWidth = 3264
- Begin VB.PictureBox picTopStudents
- Height = 1095
- Left = 120
- ScaleHeight = 1044
- ScaleWidth = 2964
- TabIndex = 1
- Top = 840
- Width = 3015
- End
- Begin VB.CommandButton cmdShow
- Caption = "Show Above-Average Students"
- Height = 495
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 3015
- End
- Attribute VB_Name = "frm7_1_4"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub cmdShow_Click()
- Dim numStudents As Integer, nTemp As String, sTemp As Integer
- Dim student As Integer, total As Integer, average As Single
- 'Determine amount of data to be processed
- numStudents = 0
- Open App.Path & "\SCORES.TXT" For Input As #1
- Do While Not EOF(1)
- Input #1, nTemp, sTemp
- numStudents = numStudents + 1
- Loop
- Close #1
- 'Create arrays for names and scores
- ReDim nom(1 To numStudents) As String, score(1 To numStudents) As Integer
- Open App.Path & "\SCORES.TXT" For Input As #1
- For student = 1 To numStudents
- Input #1, nom(student), score(student)
- Next student
- Close #1
- 'Analyze exam scores
- total = 0
- For student = 1 To numStudents
- total = total + score(student)
- Next student
- average = total / numStudents
- 'Display all names with above-average grades
- picTopStudents.Cls
- For student = 1 To numStudents
- If score(student) > average Then
- picTopStudents.Print nom(student)
- End If
- Next student
- End Sub
-