其他分享
首页 > 其他分享> > FORTRAN字符串转数字,数字转字符串

FORTRAN字符串转数字,数字转字符串

作者:互联网

FORTRAN 字符转数字和数字转字符

FORTRAN字符串转数字READ函数

      PROGRAM MAIN
      INTEGER*4   NUM
      CHARACTER*4 YRS
      REAL        TIM
C STR2INT   IN:YRS OUT:NUM
      YRS="2022"
      READ(YRS,'(I4)')NUM
C STR2FLOAT IN:YRS OUT:TIM
      YRS="2.22"
      READ(YDS,'(F4.2)') TIM
      END PROGRAM

FORTRAN数字转字符串WRITE函数

      PROGRAM MAIN
      INTEGER*4   NUM
      CHARACTER*4 YRS
      REAL        TIM
C INT2STR   IN:NUM OUT:YRS
      NUM=2022
      WRITE(YRS,'(I4)')NUM
C FLOAT2STR IN:TIM OUT:YRS
      TIM=2.22
      WRITE(YDS,'(F4.2)') TIM
      END PROGRAM

标签:PROGRAM,数字,TIM,FORTRAN,NUM,字符串,YRS,OUT
来源: https://www.cnblogs.com/liangxuran/p/16366171.html