主题:大家帮助小弟修改一下这个程序。总是搞不定啊!!谢谢了
56038,1960,10,1,98,
56038,1960,10,2,115,
56038,1960,10,3,18,
56038,1960,10,4,60,
56038,1960,10,5,20,
56038,1960,10,6,32700,
56038,1960,10,7,121,
56038,1960,10,8,22,
56038,1960,10,9,12,
56038,1960,10,10,2,
56038,1960,10,11,20,
56038,1960,10,12,60,
56038,1960,10,13,8,
56038,1960,10,14,32700,
56038,1960,10,15,25,
56038,1960,10,16,6,
56038,1960,10,17,32700,
56038,1960,10,18,22,
56038,1960,10,19,32700,
56038,1960,10,20,0,
56038,1960,10,21,0,
56038,1960,10,22,32700,
56038,1960,10,23,17,
56038,1960,10,24,0,
56038,1960,10,25,0,
56038,1960,10,26,0,这个是文件data1部分数据,
共计1033322行
这是data2,共计34行
57313
56294
56287
56251
56196
56188
56182
56172
56167
56146
56144
56079
56178
56374
56385
56386
56459
56462
56475
56479
56485
56492
56565
56571
56671
57237
57306
57313
57405
57411
57348
57426
57516
57633
这是我写的程序
implicit none
type::calcu
integer::code
integer::year
integer::month
integer::day
real::i,datumn
end type calcu
integer,parameter::num=1033321
type(calcu)::m(num)
type::clear
integer::code
integer::year
integer::month
integer::day
real::i,datumn
end type clear
integer,parameter::n=574362
type(clear)::r(n)
integer::i
integer::j
integer::k
dimension::q(33)
open(unit=10,file='data1.txt')
open(unit=11,file='data2.txt'
open(unit=20,file='result.txt')
!用循环读入每天的数据
read(10,*)
do i=1,num
read(10,*) m(i)%code,m(i)%year,m(i)%month,m(i)%day,m(i)%datumn
end do
!读站点数据
read(11,*)
do j= 1,33
read(11,*) q(i)
enddo
!输出数据
do i=1,num
do j=1,33
if(m(i)%code==q(j))
do k=1,n
write(20,"(I5)",advance='no') r(k)%code,r(k)%year,r(k)%month,r(k)%day,r(k)%datumn
enddo
endif
enddo
enddo
close(10)
close(11)
close(20)
end
56038,1960,10,2,115,
56038,1960,10,3,18,
56038,1960,10,4,60,
56038,1960,10,5,20,
56038,1960,10,6,32700,
56038,1960,10,7,121,
56038,1960,10,8,22,
56038,1960,10,9,12,
56038,1960,10,10,2,
56038,1960,10,11,20,
56038,1960,10,12,60,
56038,1960,10,13,8,
56038,1960,10,14,32700,
56038,1960,10,15,25,
56038,1960,10,16,6,
56038,1960,10,17,32700,
56038,1960,10,18,22,
56038,1960,10,19,32700,
56038,1960,10,20,0,
56038,1960,10,21,0,
56038,1960,10,22,32700,
56038,1960,10,23,17,
56038,1960,10,24,0,
56038,1960,10,25,0,
56038,1960,10,26,0,这个是文件data1部分数据,
共计1033322行
这是data2,共计34行
57313
56294
56287
56251
56196
56188
56182
56172
56167
56146
56144
56079
56178
56374
56385
56386
56459
56462
56475
56479
56485
56492
56565
56571
56671
57237
57306
57313
57405
57411
57348
57426
57516
57633
这是我写的程序
implicit none
type::calcu
integer::code
integer::year
integer::month
integer::day
real::i,datumn
end type calcu
integer,parameter::num=1033321
type(calcu)::m(num)
type::clear
integer::code
integer::year
integer::month
integer::day
real::i,datumn
end type clear
integer,parameter::n=574362
type(clear)::r(n)
integer::i
integer::j
integer::k
dimension::q(33)
open(unit=10,file='data1.txt')
open(unit=11,file='data2.txt'
open(unit=20,file='result.txt')
!用循环读入每天的数据
read(10,*)
do i=1,num
read(10,*) m(i)%code,m(i)%year,m(i)%month,m(i)%day,m(i)%datumn
end do
!读站点数据
read(11,*)
do j= 1,33
read(11,*) q(i)
enddo
!输出数据
do i=1,num
do j=1,33
if(m(i)%code==q(j))
do k=1,n
write(20,"(I5)",advance='no') r(k)%code,r(k)%year,r(k)%month,r(k)%day,r(k)%datumn
enddo
endif
enddo
enddo
close(10)
close(11)
close(20)
end