next up previous contents
Next: Formatted IO Up: File IO Previous: File IO

Solution

  PROGRAM Exam
   IMPLICIT NONE
   CHARACTER(LEN=20) :: name
   REAL :: mark1, mark2, mark3, mark4
    OPEN (UNIT=4,FILE='MARKS.DAT')
    DO
      READ(*,*) name, mark1, mark2, mark3, mark4
      IF(name == 'END')EXIT
      WRITE(UNIT=4,FMT=*) name, mark1, mark2, mark3, mark4
      WRITE(UNIT=*,FMT=*) name, mark1, mark2, mark3, mark4
    END DO
    CLOSE(UNIT=4)
  END PROGRAM

Sample data for the above program:

 Blair    94.  97.  97.  94.
 Major     2.   6.   6.   5.
 Ashdown  49.  28.  77.  66.
 END       0.   0.   0.   0.


next up previous contents
Next: Formatted IO Up: File IO Previous: File IO

©University of Liverpool, 1997
Thu May 29 10:11:26 BST 1997
Not for commercial use.