program testset
! include global data
use gd
! make available the setval routine
use setval
real :: x, y
! read values from terminal
read(*,*) a_g, b_g
! set x and y and check output
call setv(x, y)
write(*,*) x, y
end program testset
module setval
! make the global data available
use gd
implicit none
contains
subroutine setv(a, b)
real :: a, b
! set arguments to global values
a = a_g ; b = b_g
end subroutine setv
end module setval
module gd
implicit none
! define global data
real :: a_g, b_g
end module gd
Uni. Of Cambridge
Dep. Of Physics
Computational Physics
Self-study guide 2
Programming in Fortran 95
Thanks to Dr. Rachael Padman and Michaelmas for allowing the citation.
참고사이트 https://www.mrao.cam.ac.uk/~rachael/compphys/SelfStudyF95.pdf
#fortran #Dr._Rachael_Padman_and_Michaelmas #fortran_tutorial #vfun #NAG_Fortran #FTN95