        PROGRAM ptest



!  Copyright 1994, Miles Ellis, Ivor Philips and Tom Lahey

!  Copyright 1994, Addison-Wesley Publishers Ltd.

!  Copyright 1994, Addison-Wesley Publishing Company Inc.

!  Permission is granted for the use of this code for the purpose of teaching

!  and/or learning the Fortran 90 language provided that the above copyright

!  notices are included in any copies made.

!  Neither the authors nor the publishers accept any responsibility for

!  any results obtained by use of this code.



           IMPLICIT NONE

           ! This program tests the effect of printer control

           ! characters on the display and on the printer



           ! In the following declaration statement display_unit

           ! should be replaced by the unit number of the display

           ! on your computer, and printer_unit by the unit number

           ! of the printer (if one is available)

           INTEGER, PARAMETER :: display=display_unit,           &

                                 printer=printer_unit

           INTEGER :: n



           WRITE (UNIT=display,FMT=100)

           WRITE (UNIT=printer,FMT=100)

           100 FORMAT                                            &

            ("1","This line should be at the top of a new page"/ &

             " ","This should be on the next line"/              &

             "0","This line should be after a blank line"/       &

             " ","This line should be"/                          &

             "+","                    on the next line"/         &

             "0",23X,"after a blank line"/                       &

             "+","And this one should be")



           ! Wait until you have checked the output to the display

           WRITE (UNIT=display,FMT=*)                       &

             "Check the display and then type an integer"

           READ *,n



           ! Repeat the output - to see what happens to the display

           WRITE (display,FMT=100)

           WRITE (printer,FMT=100)

        END PROGRAM ptest

