这是现在的代码
[Fortran] 纯文本查看 复制代码 module typedef
type tdd
integer :: stat=0
real :: tmax , tmin , total , average
end type
end module
PROGRAM MAIN
USE typedef
implicit none
real::rain
INTEGER,PARAMETER::temp=366
type(tdd)::t(temp)! 保存气温值
type(tdd):: total !日均温累加
integer i , dy , start , end
open(7,file="CN019067")
read(7,*)
write(*,*)"start:"
read(*,*) start
write(*,*)"end:"
read(*,*) end
do i=1,start-1
read(7,*)
enddo
do i=start,end
read(7,*)dy , t(i)%tmax , t(i)%tmin , rain
t(i)%average=(t(i)%tmax+t(i)%tmin)/2 !日均温
total%average=total%average+t(i)%average !日均温累加=积温
print *, dy,total%average !
enddo
STOP
end PROGRAM
|