home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frm7_1_3
- Caption = "Exam Analysis"
- ClientHeight = 2028
- ClientLeft = 2892
- ClientTop = 2220
- ClientWidth = 3276
- 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 = 3276
- 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_3"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub cmdShow_Click()
- Dim total As Integer, student As Integer, average As Single
- 'Create arrays for names and scores
- Dim nom(1 To 8) As String, score(1 To 8) As Integer
- 'Assume the data has been placed in the file "SCORES.TXT"
- '(The first line of the file is "Richard Dolen",135)
- Open App.Path & "\SCORES.TXT" For Input As #1
- For student = 1 To 8
- Input #1, nom(student), score(student)
- Next student
- Close #1
- 'Analyze exam scores
- total = 0
- For student = 1 To 8
- total = total + score(student)
- Next student
- average = total / 8
- 'Display all names with above-average grades
- picTopStudents.Cls
- For student = 1 To 8
- If score(student) > average Then
- picTopStudents.Print nom(student)
- End If
- Next student
- End Sub
-