I am using Salford's Fortran 95 in DOS.
This program is intended to find coordinates on a 15 x 15 grid. Eventually, it will have a subroutine in addition to the function I have written. For now, I am trying to pass two variables to the function. The error from the compiler's error message is "statement not recognized" and is at the line where the function, Jill, is called.
The code:
PROGRAM Grid
!-------------------------------------------------------------------------------------------------
! This program provides a way to move about grid map of !coordinates, and
! assesses the more efficient of two methods.
!--------------------------------------------------------------------------
IMPLICIT NONE
INTEGER :: UL, LL, J
DOUBLE PRECISION :: X, Y
INTEGER :: RandX, RandY
UL = 15
LL = 1
X = 0.0
Y = 0.0
RandX = 0
RandY = 0
DO J = 1, 15
call random_seed
call random_number(X)
call random_number(Y)
Jill(X, Y, RandX, RandY)
WRITE (*,*) "The ", J, "th iteration "
END DO
CONTAINS
FUNCTION Jill(X, Y, RandX, RandY)
IMPLICIT NONE
DOUBLE PRECISION :: Jill
DOUBLE PRECISION, INTENT(IN) :: X, Y
INTEGER, INTENT(OUT) :: RandX, RandY
INTEGER :: LL, UL
Jill = 1.0
LL = 1
UL = 15
WRITE (*, '(1X, A)', ADVANCE = "NO") "X = ", X, " Y = ", Y
RandX = INT(X*(UL-LL+1)) + LL
RandY = INT(Y*(UL-LL+1)) + LL
WRITE (*, '(1X, A)', ADVANCE = "NO") "RandX = ", RandX, " RandY = ", RandY
END FUNCTION
END PROGRAM Grid
Why won't this compile? Thanks!
This program is intended to find coordinates on a 15 x 15 grid. Eventually, it will have a subroutine in addition to the function I have written. For now, I am trying to pass two variables to the function. The error from the compiler's error message is "statement not recognized" and is at the line where the function, Jill, is called.
The code:
PROGRAM Grid
!-------------------------------------------------------------------------------------------------
! This program provides a way to move about grid map of !coordinates, and
! assesses the more efficient of two methods.
!--------------------------------------------------------------------------
IMPLICIT NONE
INTEGER :: UL, LL, J
DOUBLE PRECISION :: X, Y
INTEGER :: RandX, RandY
UL = 15
LL = 1
X = 0.0
Y = 0.0
RandX = 0
RandY = 0
DO J = 1, 15
call random_seed
call random_number(X)
call random_number(Y)
Jill(X, Y, RandX, RandY)
WRITE (*,*) "The ", J, "th iteration "
END DO
CONTAINS
FUNCTION Jill(X, Y, RandX, RandY)
IMPLICIT NONE
DOUBLE PRECISION :: Jill
DOUBLE PRECISION, INTENT(IN) :: X, Y
INTEGER, INTENT(OUT) :: RandX, RandY
INTEGER :: LL, UL
Jill = 1.0
LL = 1
UL = 15
WRITE (*, '(1X, A)', ADVANCE = "NO") "X = ", X, " Y = ", Y
RandX = INT(X*(UL-LL+1)) + LL
RandY = INT(Y*(UL-LL+1)) + LL
WRITE (*, '(1X, A)', ADVANCE = "NO") "RandX = ", RandX, " RandY = ", RandY
END FUNCTION
END PROGRAM Grid
Why won't this compile? Thanks!