program main
implicit none
real,dimension(3)::a,b,c
integer::l
open(2,file='a.dat')
do l=1,3
read(*,2)a(l),b(l),c(l)
enddo
do l=1,3
print*a(l),b(l),c(l)
enddo
close(2)
end
kaola132 发表于 2015-1-28 09:31
报错如下
Error: FORMAT label 2 at (1) not defined
Process terminated with status 1 (0 minute(s), 0 s ...
pasuka 发表于 2015-1-28 09:38
- read(*,2)a(l),b(l),c(l)
+ read(2,*)a(i),b(i),c(i)
Program Main
Implicit None
Real, Dimension (3) :: A, B, C
Integer :: L
Open (2, File='a.dat')
Do L = 1, 3
Read (2, *) A(L), B(L), C(L) !// 2 和 * 写反了
End Do
Do L = 1, 3
Print *, A(L), B(L), C(L) !// 少个逗号
End Do
Close (2)
End Program Main
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |