|
以下列两个读取csv文件,program main implicit none integer :: k real ::f , a , b real ::ef10=1.09,ef25=0.31 open(12 , file ="/home/iga_qtong/fortran_xcao/fa.csv") open(13 , file ="/home/iga_qtong/fortran_xcao/faout.csv") read(12,*) do read(12,*,iostat=k) f if ( k/= 0 ) exit a=f*ef10 b=f*ef25 write(13,*) f,',',a,',',b end do close(12) close(13)end program main***********************************************************************program main implicit none integer :: k1 real ::a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r_fm,s_at,t open(12 , file ="/home/iga_qtong/fortran_xcao/farm_fm.csv") open(13 , file ="/home/iga_qtong/fortran_xcao/faarm_fmout.csv") read(12,*) do read(12,*,iostat=k1) a,b,c,d,e,f,g,h,i,j,k if ( k1/= 0 ) exit l=a*b*c m=a*b*d n=l/e o=m/f p=n*g*h q=o*g*i r_fm=p*j*10 s_at=q*k*10 t=r_fm+s_at write(13,*) l,',',m,',',n,',',o,',',p,',',q,',',r_fm,',',s_at,',',t end do close(12) close(13) end program main
如何将两个程序合并写成调用子程序的一个程序,并计算两个读取文件结果之和,即求b+t之和,输出csv文件,即
|
|