Fortran 程序链接都是对的,但运行出错,我不太会调试程序,不知道怎么的了,谢谢大家了啊~~
错误:forrtl:severe(66):outputstatementoverflowsrecord,unit-5,fileInternalFormattedWrite...
错误:forrtl: severe (66): output statement overflows record, unit -5, file Internal Formatted Write
程序:
implicit none
integer iva,imon,iyr,sta
parameter(iva=74,imon=12,iyr=60,sta=160)
real hc(iva,imon,iyr),rain(sta,imon,iyr)
real averh(iva,imon),averr(sta,imon),r(iva,sta,imon)
real sum1,sum2,su1,su2,su3
integer i,j,k,n
character m
open(10,file='E:\ly\hc068.txt',form='formatted')
read(10,100) (((hc(k,i,j),k=1,iva),i=1,imon),j=1,iyr)
100 format(37I5)
close(10)
do i=1,imon
write(m,'(i2)') i
if(i<10) then
open(20,file='E:\ly\rain\r160'//trim(adjustl(m))//'')
else
open(20,file='E:\ly\rain\r16'//trim(adjustl(m))//'')
endif
do j=1,iyr
read(20,*) (rain(n,i,j),n=1,sta)
enddo
enddo
close(20)
do k=1,iva
do i=1,imon
sum1=0
do j=1,iyr
sum1=sum1+hc(k,i,j)
enddo
averh(k,i)=sum1/iyr
enddo
enddo
do n=1,sta
do i=1,imon
sum2=0
do j=1,iyr
sum2=sum2+rain(n,i,j)
enddo
averr(n,i)=sum2/iyr
enddo
enddo
su1=0
su2=0
su3=0
do k=1,iva
do n=1,sta
do i=1,imon
do j=1,iyr
su1=(hc(k,i,j)-averh(k,i))*(rain(n,i,j)-averr(n,i))
su2=(hc(k,i,j)-averh(k,i))*(hc(k,i,j)-averh(k,i))
su3=(rain(n,i,j)-averr(k,i))*(rain(n,i,j)-averr(n,i))
enddo
r(k,n,i)=su1/(iyr*sqrt(su2/imon)*sqrt(su3/imon))
enddo
enddo
enddo
open(30,file='E:\ly\r.txt')
write(30,*) (((r(k,i,j),k=1,iva),i=1,sta),j=1,imon)
close(30)
end 展开
程序:
implicit none
integer iva,imon,iyr,sta
parameter(iva=74,imon=12,iyr=60,sta=160)
real hc(iva,imon,iyr),rain(sta,imon,iyr)
real averh(iva,imon),averr(sta,imon),r(iva,sta,imon)
real sum1,sum2,su1,su2,su3
integer i,j,k,n
character m
open(10,file='E:\ly\hc068.txt',form='formatted')
read(10,100) (((hc(k,i,j),k=1,iva),i=1,imon),j=1,iyr)
100 format(37I5)
close(10)
do i=1,imon
write(m,'(i2)') i
if(i<10) then
open(20,file='E:\ly\rain\r160'//trim(adjustl(m))//'')
else
open(20,file='E:\ly\rain\r16'//trim(adjustl(m))//'')
endif
do j=1,iyr
read(20,*) (rain(n,i,j),n=1,sta)
enddo
enddo
close(20)
do k=1,iva
do i=1,imon
sum1=0
do j=1,iyr
sum1=sum1+hc(k,i,j)
enddo
averh(k,i)=sum1/iyr
enddo
enddo
do n=1,sta
do i=1,imon
sum2=0
do j=1,iyr
sum2=sum2+rain(n,i,j)
enddo
averr(n,i)=sum2/iyr
enddo
enddo
su1=0
su2=0
su3=0
do k=1,iva
do n=1,sta
do i=1,imon
do j=1,iyr
su1=(hc(k,i,j)-averh(k,i))*(rain(n,i,j)-averr(n,i))
su2=(hc(k,i,j)-averh(k,i))*(hc(k,i,j)-averh(k,i))
su3=(rain(n,i,j)-averr(k,i))*(rain(n,i,j)-averr(n,i))
enddo
r(k,n,i)=su1/(iyr*sqrt(su2/imon)*sqrt(su3/imon))
enddo
enddo
enddo
open(30,file='E:\ly\r.txt')
write(30,*) (((r(k,i,j),k=1,iva),i=1,sta),j=1,imon)
close(30)
end 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询