|  | 
 
| 本帖最后由 sit2018 于 2018-5-27 23:20 编辑 
 编译器:compaq visual fortran 6.6
 以下代码出错:
 
 --------------------Configuration: hello - Win32 Debug--------------------
 Compiling Fortran...
 C:\Program Files\Microsoft Visual Studio\MyProjects\hello\hello.f90
 C:\Program Files\Microsoft Visual Studio\MyProjects\hello\hello.f90(33) : Error: This is an actual argument keyword name, and not a dummy argument name.   [XGUESS]
 call neqnf(fcn, x, XGUESS=xguess, FNORM=fnorm)
 -------------------^
 Error executing df.exe.
 hello.exe - 1 error(s), 0 warning(s)
 
 
 program hello
 use imsl
 implicit none
 integer n
 parameter (n = 3)
 integer k, nout
 real fnorm, x(n), xguess(n)
 external fcn
 data xguess/4.0, 4.0, 4.0/
 call umach (2,nout)
 call neqnf(fcn, x, XGUESS=xguess, FNORM=fnorm)
 write (nout, 99999) (x(k),k=1,n), fnorm
 99999 format (' the solution to the system is', /, ' x = (', 3f5.1, &
 ')', /, ' with fnorm = ', f5.4, //)
 
 end program hello
 subroutine fcn(x,f,n)
 integer n
 real x(n), f(n)
 real exp,sin
 intrinsic exp, sin
 f(1) = x(1)+exp(x(1)-1.0)+(x(2)+x(3))*(x(2)+x(3)) -27.0
 f(2) = exp(x(2)-2.0)/x(1)+x(3)*x(3)-10.0
 f(3) = x(3)+sin(x(2)-2.0)+x(2)*x(2)-7.0
 return
 end subroutine fcn
 
 
 | 
 |