作者terryys (terry)
看板Fortran
标题Re: [问题] module里面不同的function可以互相支援吗
时间Fri Nov 30 10:30:23 2012
module testmod
implicit none
contains
function a(x)
real :: a
real, intent(in) :: x
a=x**2.
end function
function b(x)
real :: b
real, intent(in) :: x
b=(x+6.)/a(x)
end function
end module
program testpro
use testmod
implicit none
print *, b(12.)
end
可以正常执行,输出0.125也是正确的答案
你的B里面宣告了另一个a,ifort和gfortran都不能编译
试试把那个a删掉?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 116.49.37.162
1F:推 ted40905:好的我试试看 11/30 18:03
2F:推 ted40905:试过,可以了! 感谢~ 11/30 18:48
3F:→ jubilee2:同MODULE内的FUNCTION不用特别宣告 11/30 22:06
4F:推 ted40905:OK 12/01 03:11