看板 Fortran 關於我們 聯絡資訊
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
ted40905:好的我試試看 11/30 18:03
ted40905:試過,可以了! 感謝~ 11/30 18:48
jubilee2:同MODULE內的FUNCTION不用特別宣告 11/30 22:06
ted40905:OK 12/01 03:11