SimWe仿真论坛's Archiver

COMSOL 2008年会圆满结束!

5812189y1 发表于 2008-5-7 16:11

module的一个问题,请大虾提示

很简单的一个程序,怎么就不对呢
f(x)=e^(-x)
想根据输入x,得到f(x)的值和它的导数值,下面是我写的程序,调试时提示:
C:\Program Files\Microsoft Visual Studio\MyProjects\iterative_solution1\ex4.f90(13) : Error: The name of the module procedure conflicts with a name in the encompassing scoping unit.   [FUNC2]
  function func2(x)
请各位帮忙看看吧,多谢了

module simple_iter
implicit none

interface
  function func2(x)
    implicit none
    real :: x
    real :: func2(2)
  end function
end interface

contains
  function func2(x)
  implicit none
  real,intent(in):: x
  real :: func2(2)
  func2(1)=exp(-x)
  func2(2)=-exp(-x)
  return
  end function
end module

program main
use simple_iter
implicit none
real :: x0
write(*,*) "Please input x0:"
read(*,*) x0
!call func2(x0)
write(*,"(2f6.2)") func2(x0)
stop
end

piteqiu 发表于 2008-8-25 10:30

语句太乱

页: [1]
 

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.