FORMAT ([format-control-statement] [, format-control-statement] ...)大部分extentsion的语法如头字段的使用在format语句中是可选的,但引导字段的使用是必选的。在前面的语法中,方括号表示可选项,而省略号则表示允许重复多次的项。Format语句的注释字段 在fortran format
Fortran中的format语句可用于各种场合,包括打印屏幕输出、写入文本文件,甚至还可以用于二进制文件的数据格式化操作。假设我们要将以下程序写入文本文件:sample_program.f90program format_example2implicit noneinteger :: i, j, kdo i= 1, 10, 2do j= 1, 5, 1k= i+jwrite (*, "(3i5)") i, j, kend...
10 format (1x,2I5,I3) write (*,ifmt) i,j,k c、write (*,'(1x,2I5,I3)') i,j,k d、character*11 fmtch fmtch='(1x,2I5,I3)' write (*,fmtch) i,j,k 其中X表示空格之意,1x即是空一格, write为输出的指令,若改为 read 则为输入指令,I为整数的格式码, 2I5 表示输出的总位数为...
10 format (1x,2I5,I3) write (*,ifmt) i,j,k c、write (*,'(1x,2I5,I3)') i,j,k d、character*11 fmtch fmtch='(1x,2I5,I3)' write (*,fmtch) i,j,k 其中X表示空格之意,1x即是空一格, write为输出的指令,若改为 read 则为输入指令,I为整数的格式码, 2I5 表示输出的总位数为...
Example 1: Assign the statement number of an executable statement: IF(LB.EQ.0) ASSIGN 9 TO K ... GO TO K ... 9 AKX = 0.0Example 2: Assign the statement number of a format statement: INTEGER PHORMAT 2 FORMAT ( A80 ) ASSIGN 2 TO PHORMAT ... WRITE ( *, PHORMAT ) 'Assigned ...
Create dynamic format,withinternal-file(=string)outFormat.!This way,the format is adjusted automaticallyifNchanges.write(outFormat,*)"(",N,"(x, f8.2))"write(*,'(a)')"a = "write(*,fmt=outFormat)&((a(i,j),j=1,N),i=1,N)!**Forall construct**forall(i=2:N:1,j=1:N:1)b...
In general, a formatted write statement does the following:Gets data from internal storage for each list item specified by the list.Converts the items from binary to character form according to the instructions in the associated format.Transfers the items to the external record or to an internal...
Write(字符串,*) 整型或实型:数字->字符串 字符串允许使用子字符串表示字符串的一部分,是一种特殊的数组。 语法中有很多内容本身也是字符串,如文件名,Open语句的子句和格式Format等。 利用字符串可以实现批量文件处理以及动态Format等功能,后续会讲到。
I run into a output conversion problem with Intel Visual Fortran Composer XE 2011. The following is the code:"WRITE(6,7330) II,IVCONST,DUMMY WRITE(25,7330) II,IVCONST,DUMMY7330 FORMAT(1X,' Row#,Constraint#= ',2I10,2X,A55, & ' cannot be satisfied but is in the sufficient se...
/换行输出。write(*,"(I3//3)") 10,10 程序会得出4行,中间两行空格是从除号"/"得到的。 下面是实例总结: 1、FORMAT(5X,'***',/,5X,'NON E* POSSIBILIE L ESTRAPOLAZIONE DELIA CURVA MOT') 结果:5个空格*** 5个空格NON E* POSSIBILIE L ESTRAPOLAZIONE DELIA CURVA MOT 2、fortran...