主题:小数问题
REAL A(70000,5),B(70000,5)
INTEGER STAR,END
WRITE(*,*)'INPUT STAR NUMBER'
READ(*,*) STAR
WRITE(*,*)'INPUT END NUMBER'
READ(*,*) END
OPEN(UNIT=1,FILE='data.dat',STATUS='OLD')
OPEN(UNIT=2,FILE='res.dat',STATUS='UNKNOWN')
READ(1,*)((A(I,K),K=1,5),I=1,END)
DO 10 I=STAR,END
DO 20 K=1,5
B(I,K)=A(I,K)*1000
20 CONTINUE
10 CONTINUE
MAX=ABS(A(1,1))*1000
DO 30 I=STAR,END
DO 40 K=1,5
IF(MAX.LT.ABS(A(I,K))*1000) MAX=ABS(A(I,K))*1000
40 CONTINUE
30 CONTINUE
WRITE(2,*) 'MAX=',MAX
WRITE(2,2)((B(I,K),K=1,5),I=STAR,END)
2 FORMAT(5F15.5)
CLOSE(1)
CLOSE(2)
END
如何让输出的max值是小数点后面四位的数值
INTEGER STAR,END
WRITE(*,*)'INPUT STAR NUMBER'
READ(*,*) STAR
WRITE(*,*)'INPUT END NUMBER'
READ(*,*) END
OPEN(UNIT=1,FILE='data.dat',STATUS='OLD')
OPEN(UNIT=2,FILE='res.dat',STATUS='UNKNOWN')
READ(1,*)((A(I,K),K=1,5),I=1,END)
DO 10 I=STAR,END
DO 20 K=1,5
B(I,K)=A(I,K)*1000
20 CONTINUE
10 CONTINUE
MAX=ABS(A(1,1))*1000
DO 30 I=STAR,END
DO 40 K=1,5
IF(MAX.LT.ABS(A(I,K))*1000) MAX=ABS(A(I,K))*1000
40 CONTINUE
30 CONTINUE
WRITE(2,*) 'MAX=',MAX
WRITE(2,2)((B(I,K),K=1,5),I=STAR,END)
2 FORMAT(5F15.5)
CLOSE(1)
CLOSE(2)
END
如何让输出的max值是小数点后面四位的数值