主题:大神啊求助
program main
integer,dimension(1:14) ::p0
real,dimension(1:14)::t0,td0,ee,ees
real a,b,t,t1,td,td1,e,e1,e2,es1,es2
open(1,file="tk.txt")
read(1,*)
do i=1,14
read(1,10) p0(i),t0(i),td0(i)
10 format(i3,9x,f5.1,3x,f5.1)
t=t0(i)
td=td0(i)
t1=t+273.15
td1=td+27.15
a=17.269
b=35.86
e1=6.1078*exp(a*(td1-273.15)/(td1-b))
es1=6.1078*exp(a*(t1-273.15)/(t1-b))
a=21.87
b=7.66
e2=6.1078*exp(a*(td1-273.15)/(td1-b))
es2=6.1078*exp(a*(t1-273.15)/(t1-b))
if((t>-15).or.(td>-15))then
e=e1
es=es1
else if((t<-40).or.(td<-40))then
e=e2
es=es2
else
e=0.002*((80+2*td)*e1-(30+2*td)*e2)
es=0.002*((80+2*t)*es1-(30+2*t)*es2)
endif
ee(i)=e
ees(i)=es
enddo
close(1)
open(2,file="1.txt")
print *,"--print new file--"
do i=1,14
write(2,100) p0(i),ee(i),ees(i)
enddo
100 format(1x,i3,2(3x,f5.1))
close(2)
end
结果截图在附件中有错误谢谢大神了
integer,dimension(1:14) ::p0
real,dimension(1:14)::t0,td0,ee,ees
real a,b,t,t1,td,td1,e,e1,e2,es1,es2
open(1,file="tk.txt")
read(1,*)
do i=1,14
read(1,10) p0(i),t0(i),td0(i)
10 format(i3,9x,f5.1,3x,f5.1)
t=t0(i)
td=td0(i)
t1=t+273.15
td1=td+27.15
a=17.269
b=35.86
e1=6.1078*exp(a*(td1-273.15)/(td1-b))
es1=6.1078*exp(a*(t1-273.15)/(t1-b))
a=21.87
b=7.66
e2=6.1078*exp(a*(td1-273.15)/(td1-b))
es2=6.1078*exp(a*(t1-273.15)/(t1-b))
if((t>-15).or.(td>-15))then
e=e1
es=es1
else if((t<-40).or.(td<-40))then
e=e2
es=es2
else
e=0.002*((80+2*td)*e1-(30+2*td)*e2)
es=0.002*((80+2*t)*es1-(30+2*t)*es2)
endif
ee(i)=e
ees(i)=es
enddo
close(1)
open(2,file="1.txt")
print *,"--print new file--"
do i=1,14
write(2,100) p0(i),ee(i),ees(i)
enddo
100 format(1x,i3,2(3x,f5.1))
close(2)
end
结果截图在附件中有错误谢谢大神了