菜鸟一个,一个简单的程序 竟然有31个错误,求大神指教
系统版本win8.1 64位,编译环境microsoft visual studio2010 Intel.Visual.Fortran.Composer.XE.2011下面小弟的代码错误一箩筐求指教
program tajing
implicit none
real,external::H,LV
real,external::W,C,Ci
real L,V,Rl,Rv,Ht,hli,st
call sub_di(V,W)
end
subroutine sub_di(V,W)
implicit none
real,external::W,Ci
real L,V,Rl,Rv,Ht,hli,st
read Ht,hli
read L,V,Rl,Rv
read st
call W(C,Rl,Rv)
Di=(V/0.785/W(C,Rl,Rv))**0.5
print *,"初步估计塔径Di:",Di
end subroutine
subroutine W(C,Rl,Rv)
implicit none
real,external::C
real Rl,Rv,W
call C(Ci,st)
W=0.8*C*((Rl-Rv)/Rv)**0.5
print *,"选取计算空速W:",W
end subroutine
subroutine C(Ci,st)
implicit none
real,external::Ci
real st,C
read st
call Ci(H,LV)
C=Ci/(20/st)**0.2
print *,"经验系数C:",C
end subroutine
subroutine Ci(H,LV)
implicit none
real,external::H,LV
real Ci
Ci=exp(-4.531+1.6562*H+5.5496*H**2-6.4695*H**3+&
(-0.474675+0.079*H-1.39*H**2+1.3212H**3)*log(expr)LV&
+(-0.07291+0.088307*H-0.49123*H**2+0.43196*H**3)*(log(expr)LV)**2)
print *,"标准系数Ci:",Ci
end subroutine
function H(Ht,hli)
implicit none
real Ht,hli
real H
read Ht,hli
H=Ht-hli
end function
function LV(L,V,Rl,Rv)
implicit none
real L,V,Rl,Rv
real LV
read L,V,Rl,Rv
LV=L*(Rl/Rv)**0.5/V
end function
程序里面一些基本的错误是一眼可以看出来了的,比如read语句的基本用法,请楼主先把一些最基本的错误改掉 错误太多了,没法改。
read Ht,hli
需要改成 read(*,*) Ht,hli,其他类似
在 sub_di 函数里。W 被定义为外部的函数。那么就不能 call W(Ci,Rl,Rv),因为 call 是对子例行程序。
先改了这两条。然后上新的代码。 已改过!定义的external不是把外部子程序名作为形参吗?为什么不能call?
program tajing
implicit none
real,external::H,LV
real,external::W,C,Ci
real L,V,Rl,Rv,Ht,hli,st
call sub_di(V,W)
end
subroutine sub_di(V,W)
implicit none
real,external::W,Ci
real L,V,Rl,Rv,Ht,hli,st
read(*,*)Ht,hli
read(*,*)L,V,Rl,Rv
read(*,*)st
call W(C,Rl,Rv)
Di=(V/0.785/W(C,Rl,Rv))**0.5
print *,"初步估计塔径Di:",Di
end subroutine
subroutine W(C,Rl,Rv)
implicit none
real,external::C
real Rl,Rv,W
call C(Ci,st)
W=0.8*C*((Rl-Rv)/Rv)**0.5
print *,"选取计算空速W:",W
end subroutine
subroutine C(Ci,st)
implicit none
real,external::Ci
real st,C
read(*,*)st
call Ci(H,LV)
C=Ci/(20/st)**0.2
print *,"经验系数C:",C
end subroutine
subroutine Ci(H,LV)
implicit none
real,external::H,LV
real Ci
Ci=exp(-4.531+1.6562*H+5.5496*H**2-6.4695*H**3+&
(-0.474675+0.079*H-1.39*H**2+1.3212H**3)*log(expr)(LV)&
+(-0.07291+0.088307*H-0.49123*H**2+0.43196*H**3)*(log(expr)(LV))**2)
print *,"标准系数Ci:",Ci
end
function H(Ht,hli)
implicit none
real Ht,hli
real H
read(*,*)Ht,hli
H=Ht-hli
end function
function LV(L,V,Rl,Rv)
implicit none
real L,V,Rl,Rv
real LV
read(*,*)L,V,Rl,Rv
LV=L*(Rl/Rv)**0.5/V
end function call 是对子例行程序
函数不能 call,只能是 返回值 = 函数名(参数....)
页:
[1]