本帖最后由 珊瑚虫 于 2014-2-21 21:45 编辑
在chuxf的基础上稍作修改,即可实现所有的opq全部修改为ooo :lol
在程序中加了"goto 10"
[Fortran] 纯文本查看 复制代码 Program www_fcode_cn
Implicit None
Character( Len = 512 ) :: c
integer :: i
Open( 12 , File = "1.txt" )
Open( 13 , File = "2.txt" )
Do
Read( 12 , '(a512)' , ioStat = i ) c
if ( i /= 0 ) Exit
10 i = index( c , "opq" )
if ( i > 0 ) then
c(i:i+len_trim("opq")-1) = "ooo"
goto 10
end if
Write( 13 , '(a)' ) Trim(c)
End Do
Close( 12 )
Close( 13 )
End Program www_fcode_cn
|