|||
如果变量是一维的,即一个数,那么不用定义其维度为“A(1)”,直接定义为双精度变量Double Precision A,即可在之后的运算中调用,否则需要在之后的调用中输入“A(1)”而不是“A”。
For example:
program main
implicit none
dimension x(1),y(1),z(1),M(1),Omega(1),gm(1)
double precision x,y,z,M,L,Omega,gm
x=1
y=2
Omega=1
call equation2(x,y,z,M,Omega,gm)
open(file='result.dat',unit=1)
write(1,'(1X, 4E20.10)') z,M,gm,0.5374E-98
close(1)
end program main
subroutine equation1(Omega,gm)
implicit none
dimension Omega(1),gm(1)
double precision Omega,gm
gm=Omega*80
return
end subroutine equation1
subroutine equation2(x,y,z,M,Omega,gm)
implicit none
dimension x(1),y(1),z(1),M(1),Omega(1),gm(1)
double precision x,y,z,M,Omega,gm
call equation1(Omega,gm)
z=x+y+gm
return
end subroutine equation2
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-24 08:00
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社