!
! =====> Program - P47.F90
!
!
! CLASS LIST PROGRAM
!
CHARACTER (LEN=20) :: NAME
REAL MARK
!
!
PRINT *, 'This is Program >> P47 - Class List program'
!
! Tell program where data for READ * is coming from
OPEN(UNIT=5, FILE='P47.DAT') ! UNIT=5 is the default input
!
PRINT 1
1 FORMAT(//'CLASS LIST:' &
///' NAME',19X,'MARK') ! The /// give 2 blank lines
!
READ *,N
AVE=0
L1: DO I=1,N
READ 10,NAME,MARK
10 FORMAT(A20,F5.2) ! Real data entered with decimal point
AVE=AVE+MARK
PRINT 20,NAME,MARK
20 FORMAT(' ',A20,F7.1)
END DO L1
!
AVE=AVE/N
PRINT 30,AVE
30 FORMAT(' ',27('-')/ & ! 27 dashes for a separator
' AVERAGE',13X,F7.1) ! This is on the line below
!
PRINT 56
56 FORMAT(' ') ! Print a blank line
STOP
END
DATA:
5
Mickey Mouse 85.0
Goofy 100.0
Pluto 82.0
Dumbo 100.0
Cinderella 5.0
OUTPUT:
Program entered
This is Program >> P47 - Class List program
CLASS LIST:
NAME MARK
Mickey Mouse 85.0
Goofy 100.0
Pluto 82.0
Dumbo 100.0
Cinderella 5.0
---------------------------
AVERAGE 74.4
Fortran-90 STOP
Page builder: Charles Boivin
Last modified: 11/07/95