dimension n(3,3)
integer i,j
read (*,1)((n(i,j),j=1,3),i=1,3)
write (*,1)n
1 FORMAT (2X,'n=',3I6.2/2(4X,3I6.2/))
end
integer :: n(3,3)
read (*,*) n
write (*,'(3(3i6.2/))') n
end
integer :: n(3,3)
Open( 111 , File = '文件名' )
read (111,*) n
write (*,'(3(3i6.2/))') n
end
vvt 发表于 2014-6-11 19:21
不要用 dimension,不要用格式符read
[mw_shl_code=fortran,true]integer :: n(3,3)
安靖 发表于 2014-6-11 18:54
txt里数据格式怎么样的?
dimension a(3,3)
open (1,file='E\1.txt')
do 10 i=1,3
read(1,*)(a(i,j),j=1,3)
10 continue
write(*,*)((a(i,j),j=1,3),i=1,3)
100 FORMAT (2x,7f6.2/6(2x,7f6.2/))
end
chuxf 发表于 2014-6-11 23:19
第一,不要用 dimension
第二,请弄清楚数据的类型,是整型,还是浮点型。
整型用 integer 定义,用 I 格式 ...
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |