[Fortran] 纯文本查看 复制代码
program main
implicit none
integer i,j
integer ::k
integer ::b,c
real ::a(48,11)
real l,m,n,o,p,q,r_fm,s_at,t
open(12 , file ="/home/iga_qtong/fortran_xcao/farm/farm_fm.csv")
open(13 , file ="/home/iga_qtong/fortran_xcao/farm/farmout.csv")
! read(12,*) a(i,j)
read(12,*) ((a(i,j), j=1,c),i=1,b)
do
read(12,*,iostat=k) a(48,11)
if (k/=0) exit
do i=1,48
do j=1,11
l=a(i,1)*a(i,2)*a(i,3)
m=a(i,1)*a(i,2)*a(i,4)
n=l/a(i,5)
o=m/a(i,6)
p=n*a(i,7)*a(i,8)
q=o*a(i,7)*a(i,9)
r_fm=p*a(i,10)*10
s_at=q*a(i,11)*10
t=r_fm+s_at
write(13,*) l,',',m,',',n,',',o,',',p,',',
& q,',',r_fm,',',s_at,',',t
end do
end do
end do
close(12)
close(13)
end program main
[Fortran] 纯文本查看 复制代码
program main
implicit none
integer k!,i,j
real ::a(11) !//一维数组就可以了
real l,m,n,o,p,q,r_fm,s_at,t
open(12 , file ="/home/iga_qtong/fortran_xcao/farm/farm_fm.csv")
open(13 , file ="/home/iga_qtong/fortran_xcao/farm/farmout.csv")
! read(12,*) a(i,j) !//没用
!do !//这层循环没用
!read(12,*,iostat=k) a(48,11) !//此句没用
do
read(12,*,ioStat=k) a !//b c 没用值
if (k/=0) exit
!do j=1,11 !//这层循环也没用
l=a(1)*a(2)*a(3)
m=a(1)*a(2)*a(4)
n=l/a(5)
o=m/a(6)
p=n*a(7)*a(8)
q=o*a(7)*a(9)
r_fm=p*a(10)*10
s_at=q*a(11)*10
t=r_fm+s_at
write(13,*) l,',',m,',',n,',',o,',',p,',', &
q,',',r_fm,',',s_at,',',t
!end do !//
end do
!end do
close(12)
close(13)
end program main