Hi,
I have this code for sorting N numbers X(I) in increasing order.
DIMENSION X(100)
READ (*,*) N, (X(I),I=1,N)
N1=N-1
DO 15 I=1,N1
AMIN=X(I)
M=I+1
DO 25 K=M,N
IF (AMIN.LE.X(K)) GO TO 25
Z=AMIN
AMIN=X(K)
X(K)=Z
25 CONTINUE
15 X(I)=AMIN
WRITE (*,2) (X(I),I=1,N)
2 FORMAT (10(3X,F5.2))
STOP
END
I dont want to read data from keyboard but from a file.And then write the result in to a another file.
Does anyone know how this will work??
Many thanks
I have this code for sorting N numbers X(I) in increasing order.
DIMENSION X(100)
READ (*,*) N, (X(I),I=1,N)
N1=N-1
DO 15 I=1,N1
AMIN=X(I)
M=I+1
DO 25 K=M,N
IF (AMIN.LE.X(K)) GO TO 25
Z=AMIN
AMIN=X(K)
X(K)=Z
25 CONTINUE
15 X(I)=AMIN
WRITE (*,2) (X(I),I=1,N)
2 FORMAT (10(3X,F5.2))
STOP
END
I dont want to read data from keyboard but from a file.And then write the result in to a another file.
Does anyone know how this will work??
Many thanks