主题:[转帖]提示no implicit none
bisection.f90:13.22:
subroutine typ_value(a,b)
1
Error: Symbol 'a' at (1) has no IMPLICIT type
bisection.f90:13.24:
subroutine typ_value(a,b)
1
Error: Symbol 'b' at (1) has no IMPLICIT type
bisection.f90:28.10:
use globle
1
Fatal Error: Can't open module file 'globle.mod' for reading at (1): No such file or directory
以下是程序:
module globle
implicit none
real :: a,b,c
contains
real function func(x)
implicit none
real :: x
func=1.0-x*x
return
end function
subroutine typ_value(a,b)
c=(a+b)/2.0
return
end subroutine
subroutine product(m,n)
real :: m,n,pro
pro=func(m)*func(n)
return
end subroutine
end module globle
program bisection
use globle
implicit none
real :: pro1
real,external :: func
write(*,*)'please input two values'
100 read(*,*)a,b
call product(a,b)
pro1=pro
if(pro1<0)then
call mid()
call typ_value(a,b)!gain the value of c
call product(a,c)!gain the value of func(a)*func(c)
if(pro<0)then
b=c
entry mid()
else if(pro>0)then
a=b
entry mid()
else
exit
end if
else if(pro1>0)then
write(*,*)'please re-input two values'
goto 100
else
if(func(a)==0)then
c=a
else
c=b
end if
end if
write(*,*)'the sulution between',a,'and'b,'is'1x,func(c)
end
subroutine typ_value(a,b)
1
Error: Symbol 'a' at (1) has no IMPLICIT type
bisection.f90:13.24:
subroutine typ_value(a,b)
1
Error: Symbol 'b' at (1) has no IMPLICIT type
bisection.f90:28.10:
use globle
1
Fatal Error: Can't open module file 'globle.mod' for reading at (1): No such file or directory
以下是程序:
module globle
implicit none
real :: a,b,c
contains
real function func(x)
implicit none
real :: x
func=1.0-x*x
return
end function
subroutine typ_value(a,b)
c=(a+b)/2.0
return
end subroutine
subroutine product(m,n)
real :: m,n,pro
pro=func(m)*func(n)
return
end subroutine
end module globle
program bisection
use globle
implicit none
real :: pro1
real,external :: func
write(*,*)'please input two values'
100 read(*,*)a,b
call product(a,b)
pro1=pro
if(pro1<0)then
call mid()
call typ_value(a,b)!gain the value of c
call product(a,c)!gain the value of func(a)*func(c)
if(pro<0)then
b=c
entry mid()
else if(pro>0)then
a=b
entry mid()
else
exit
end if
else if(pro1>0)then
write(*,*)'please re-input two values'
goto 100
else
if(func(a)==0)then
c=a
else
c=b
end if
end if
write(*,*)'the sulution between',a,'and'b,'is'1x,func(c)
end