那你岂不是很辛苦,哈哈。还有一个问题。
[Fortran] 纯文本查看 复制代码 subroutine intoch ( cvar, ivar, ilend)
c***********************************************************************
c* *
c* PURPOSE: Write integer left-justified into character variable *
c* *
c* ARGUMENTS: CVAR - character variable receiving integer *
c* IVAR - integer to write into character *
c* ILEND - obsolete *
c* *
c***********************************************************************
c---- Dummy arguments
character*(*) cvar
integer ivar, ilend
c-- Local working storage
character cform*5
integer ilen, ivara
c---- Find required length to write IVAR, including sign
ivara = abs(ivar)
ilen = 1
mag = 10
do 100 i=1,10
if (ivara.lt.mag) go to 200
ilen = ilen + 1
100 mag = mag * 10
200 if (ivar.lt.0) ilen = ilen + 1
c---- Write IVAR into CVAR, left justified. If CVAR length is not
c enough, FORTRAN error handling is used ('*****')
ilen = min(ilen,len(cvar))
write (cform,'(a,i2,a)') '(I',ilen,')'
cvar = ' '
write (cvar,cform) ivar
return
end
倒数第三行,为什么cform也写到了格式的位置,难道是按照cform的格式表示ivar,然后将值赋给cvar? |