亲爱的大家,我正在编写一个代码,将输出写入多个名为 1.dat、2.dat 的文件中......这是我的代码,但它给出了一些不寻常的输出。你能告诉我我的代码有什么问题吗?基本上我无法获得正确的语法来打开多个文件,在它们上写入并在打开下一个文件之前关闭。谢谢你。我的代码:
implicit double precision (a-h,o-z),integer(i-n)
dimension b(3300,78805),bb(78805)
character*70,fn
character*80,fnw
nf = 3600 ! NUMBER OF FILES
nj = 360 ! Number of rows in file.
do j = 1, nj
bb(j) = 0.0
end do
c-------!Body program-----------------------------------------------
iout = 0 ! Output Files upto "ns" no.
DO i= 1,nf ! LOOP FOR THE NUMBER OF FILES
if(mod(i,180).eq.0.0) then
open(unit = iout, file = 'formatted')
x = 0.0
do j = 1, nj
bb(j) = sin(x)
write(iout,11) int(x),bb(j)
x = x + 1.0
end do
close(iout)
iout = iout + 1
end if
END DO
11 format(i0,'.dat')
END