!------------------------------------------------------------------------------
!
!  Program name:
!
!    circledef3
!
!  Purpose:
!
!    This program defines a derived type for a circle and reads in
!    the values by component from standard input 
!
!------------------------------------------------------------------------------

PROGRAM circledef3  
                   
  IMPLICIT NONE      ! no implicit typing

  TYPE point         ! defines type point
    REAL x,y
  END TYPE point

  TYPE circle        ! defines type circle
    TYPE(point) centre
    REAL        radius
  END TYPE circle

  TYPE(point) o      ! o is type point
  TYPE(circle) one   ! one is type circle

                     ! requests user to input numbers
  PRINT *,'Input a point which defines the centre of the circle'

  READ (*,*) o       ! reads in point o by component
  one%centre = o

  PRINT *,'Input the radius' ! requests user to input radius
  READ (*,*) one%radius      ! reads in radius by component

  PRINT '(/)'
  PRINT *,'Print centre of circle by components'
  WRITE (*,'(2F6.2,/)') o%x,o%y

  PRINT *,'Print centre of circle by derived type'
  WRITE (*,*) o

  PRINT '(//)'
  PRINT *,'Print circle by components'
  WRITE (*,'(3F6.2,/)') one

  PRINT *,'Print circle by derived type'
  WRITE (*,*) one
  PRINT '(//)'

END PROGRAM circledef3
