home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH7 / 7-1-3.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-10-11  |  2.1 KB  |  68 lines

  1. VERSION 5.00
  2. Begin VB.Form frm7_1_3 
  3.    Caption         =   "Exam Analysis"
  4.    ClientHeight    =   2028
  5.    ClientLeft      =   2892
  6.    ClientTop       =   2220
  7.    ClientWidth     =   3276
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   7.8
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    LinkTopic       =   "Form1"
  18.    PaletteMode     =   1  'UseZOrder
  19.    ScaleHeight     =   2028
  20.    ScaleWidth      =   3276
  21.    Begin VB.PictureBox picTopStudents 
  22.       Height          =   1095
  23.       Left            =   120
  24.       ScaleHeight     =   1044
  25.       ScaleWidth      =   2964
  26.       TabIndex        =   1
  27.       Top             =   840
  28.       Width           =   3015
  29.    End
  30.    Begin VB.CommandButton cmdShow 
  31.       Caption         =   "Show Above-Average Students"
  32.       Height          =   495
  33.       Left            =   120
  34.       TabIndex        =   0
  35.       Top             =   120
  36.       Width           =   3015
  37.    End
  38. Attribute VB_Name = "frm7_1_3"
  39. Attribute VB_GlobalNameSpace = False
  40. Attribute VB_Creatable = False
  41. Attribute VB_PredeclaredId = True
  42. Attribute VB_Exposed = False
  43. Private Sub cmdShow_Click()
  44.   Dim total As Integer, student As Integer, average As Single
  45.   'Create arrays for names and scores
  46.   Dim nom(1 To 8) As String, score(1 To 8) As Integer
  47.   'Assume the data has been placed in the file "SCORES.TXT"
  48.   '(The first line of the file is "Richard Dolen",135)
  49.   Open App.Path & "\SCORES.TXT" For Input As #1
  50.   For student = 1 To 8
  51.     Input #1, nom(student), score(student)
  52.   Next student
  53.   Close #1
  54.   'Analyze exam scores
  55.   total = 0
  56.   For student = 1 To 8
  57.     total = total + score(student)
  58.   Next student
  59.   average = total / 8
  60.   'Display all names with above-average grades
  61.   picTopStudents.Cls
  62.   For student = 1 To 8
  63.     If score(student) > average Then
  64.         picTopStudents.Print nom(student)
  65.     End If
  66.   Next student
  67. End Sub
  68.