[Fortran] 纯文本查看 复制代码
program main1
implicit none
real (kind=4) :: r,s,x,u,v,q,k,p
integer , parameter :: l=5
integer :: t
integer :: status=0
x=0
t=0
write(*,*) "压差p(MPa)"
read(*,*) p
open(unit=10,file="test.txt")
do while(.true.)
read(10,"(F9.3)",iostat=status)r
write(*,*)"r=", r
s=3.14*(r*0.0001/2)**2
write(*,"(' s=',2X,F15.13)") s
do while (x<=l)
u=(5*(l-x)**2+0.75*x**2)/((l-x)**2+x**2)
v=((r*0.000001/2))**2*p*1000000/(8*u*0.001*0.05*100)
q=v*s
x=x+v
t=t+1
end do
write(*,*) "t=",t
write(*,*) "x=",x
write(*,*) "u=",u
write(*,"(' v=',2X,F10.8)") v
write(*,"(' q=',2X,F15.13)") q
if(status/=0) exit
end do
STOP
end