fortran 字符串太长 如何换行
在前面的绿竖杠中加$.这就代表换行了。
例如:
c='This a very very very very very very very very very very very &
&very very very very very very very very very very very very very &
&very long sentence.'
前一行行尾和下一行行首加&,这是自由格式,文件后缀为*.f90。
扩展资料:
注意事项
在Fortran中当程序代码中的一行超过132个字符时,至多可以有39个续行。续行标志固定为“&”。当一行代码的最后一个字符为“&”时,则表示下一行与本行接续;当一行代码的第一个字符为“&”时,则表示本行与上一行接续。
在不同的类型之间进行转换是有限制条件的:数值型以及逻辑型数据之间允许相互赋值转换;数值型数据与字符型数据之间则不允许进行直接赋值转换,需要使用专用的字符函数;逻辑型数据不允许与字符型数据之间进行直接或间接的转换。
整型数据与实型数据的相互转换遵循如下规则:整形向实型转换时,保持数值的大小不变,实型向整型转换时,直接将实型的小数部分截去。
在前面的绿竖杠中加$.这就代表换行了。
例如:
c='This a very very very very very very very very very very very &
&very very very very very very very very very very very very very &
&very long sentence.'
扩展资料:
特性
Fortran语言的最大特性是接近数学公式的自然描述,在计算机里具有很高的执行效率。易学,语法严谨。可以直接对矩阵和复数进行运算,这一点类似matlab。自诞生以来广泛地应用于数值计算领域,积累了大量高效而可靠的源程序。
很多专用的大型数值运算计算机针对Fortran做了优化。广泛地应用于并行计算和高性能计算领域。Fortran90,Fortran95,Fortran2003的相继推出使Fortran语言具备了现代高级编程语言的一些特性。
如:x=2+5&
+6
又如:x=sin(4.0)+si&
&n(1.0)
c='This a very very very very very very very very very very very &
&very very very very very very very very very very very very very &
&very long sentence.'
前一行行尾和下一行行首加&。这是自由格式,文件后缀为*.f90。
前面几楼提到的绿线栏指的是Fortran早期的固定格式,该格式续行的方法略有不同。但实际上这种格式已经过时了,所以你不用管它。。。
有问题再交流
或者可以把文件后缀直接改为“.f90”,就不要换行了