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
报错如下
Error: FORMAT label 2 at (1) not defined
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))
谢谢,不过又出现了这个报错,昨天也是,
Error: Expected comma in I/O list at (1)
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
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