读文件里的数据时,数据可以读进数组里,但是输出到屏幕时,与文件里的数据存在很大差异
[Fortran] 纯文本查看 复制代码 Program data
integer record
real,allocatable::x(:),h(:)
open(10,file="扩边前.dat")
record=0
do while(.not.eof(10))
read(10,*)
record=record+1
end do
allocate(x(record),h(record))
do while(.not.eof(10))
do i=1,record
read(10,*)x(i),h(i)
end do
end do
do i=1,record
write(*,*)x(i),h(i)
end do
end program
|