我修改了一下,结果正确。有疑问站内交流哦!
REAL, ALLOCATABLE:: X(:,:)
REAL, ALLOCATABLE:: OLDX(:,:)
REAL A,B
INTEGER IO, N
ALLOCATE( OLDX(0,0) )
N = 0
OPEN( 1, FILE = 'DATA' )
DO
READ(1, *, IOSTAT = IO)A,B
IF (IO < 0 ) EXIT
N = N + 1
ALLOCATE( X(N,2) )
DO NN=1,N-1
X(NN,1)=OLDX(NN,1)
X(NN,2)=OLDX(NN,2)
ENDDO
X(N,1) = A
X(N,2) = B
DEALLOCATE( OLDX )
ALLOCATE(OLDX(N,2))
DO NN=1,N
OLDX(NN,1)=X(NN,1)
OLDX(NN,2)=X(NN,2)
ENDDO
write(*,*)'bb=',X(N,2)
DEALLOCATE( X )
ENDDO
DO I=1,N
write(*,'(2f10.5)') OLDX(I,1),OLDX(I,2)
ENDDO
END
[ 本帖最后由 苍山负雪 于 2006-6-23 09:20 编辑 ] |