41 Insufficient virtual memory 虚拟内存不足
70 Integer overflow 整数溢出错误
71 Integer divide by zero 整数除0错误
72 Floating overflow 浮点数溢出错误
73 Floating divide by zero 浮点数除0错误
74 Floating underflow 浮点数下溢错误
75 Floating point exception 浮点数异常错误
77 Subscript out of range 数组定义超出边界
95 Floating-point conversion failed 浮点数格式转换失败
146 Null pointer error 空指针错误
147 Stack overflow 堆栈溢出
148 String length error 字符串长度超出允许范围
149 Substring error 数组下标超出允许范围
150 Range error 整数值超出允许范围
151 Allocatable array is already allocated 数组重复定义
161 Program Exception - array bounds exceeded 引用数组下标超出允许范围
162 Program Exception - denormal floating-point operand 非法浮点数操作符
163 Program Exception - floating stack check 浮点数堆栈检查
164 Program Exception - integer divide by zero 整数除0错误
165 Program Exception - integer overflow 整数溢出
166 Program Exception - privileged instruction 非法执行特权指令
168 Program Exception - illegal instruction 非法指令
170 Program Exception - stack overflow 堆栈溢出
540 Array or substring subscript expression out of range 数组下标低下数组定义
下界或高于数组定义上界
541 CHARACTER substring expression out of range 字符串非法表示
542 Label not found in assigned GOTO list 不属于GOTO语句引用的标号
543 INTEGER arithmetic overflow 整数运算结果出现溢出
544 INTEGER overflow on input 输入的整数值超出允许范围
545 Invalid INTEGER 非法整数值
546 REAL indefinite (uninitialized or previous error) 产生非法实数
547 Invalid REAL 非法实数
548 REAL math overflow 实数值溢出
549 No matching CASE found for SELECT CASE select case语句中缺少case项
550 INTEGER assignment overflow 整数定义超出允许范围
556 A edit descriptor expected for CHARACTER 字符型数据的格式化输入和输出需要A编辑符
557 E, F, D, or G edit descriptor expected for REAL 实数型数据的格式化输入和输
出需要E,F,D,G编辑符
558 I edit descriptor expected for INTEGER 整数型数据的格式化输入和输出需要I编辑符
559 L edit descriptor expected for LOGICAL 逻辑型数据的格式化输入和输出需要L编辑符
568 Multiple radix specifiers 输入或输出语句重复说明
582 Array already allocated 数组已分配
583 Array size zero or negative 数组大小为0或负数
585 Array not allocated 没有被分配的数组
610 Invalid argument 非法参数
616 Invalid number in input 输入非法数字
617 Invalid string in input 输入非法字符串
618 Comma missing in COMPLEX input 输入的多个表达式之间缺少逗号
619 T or F expected in LOGICAL read 输入的逻辑值必须是T或F
622 Illegal character in hexadecimal input 输入非法的十六进制数
637 Integer expected in format 格式语句中要求的整数
638 Initial left parenthesis expected in format 格式语句中多余的左括号
639 Positive integer expected in format 格式语句中要求用正整数
641 Integer expected preceding H, X, or P edit descriptor 在H、X、P编辑符前要
求用整数
644 '.' expected in format 在D、E、F、G编辑符中w和d域之间用'.'分隔
645 Unexpected end of format 格式语句没有结束
646 Unexpected character in format 格式语句中的非法字符
647 M field exceeds W field in I edit descriptor 在I编辑符中M域的值大于W域的值
648 Integer out of range in format 格式语句中的整数值超出允许范围
650 Separator expected in format 格式语句中需要分隔符
663 Out of range: substring starting position 'pos' is less than 1 子字符串的
起始位置小于1
664 Out of range: substring ending position 'pos' is greater than string leng
th 'len' 子字符串的终止位置大于字符串长度
672 Out of memory 内存不足
718 Cannot allocate temporary array -- out of memory 由于内存不足不能分配临时
数组
727 Cannot ALLOCATE allocatable array -- out of memory 由于内存不足不能分配数组
729 DEALLOCATE failure: ALLOCA TABLE array is not ALLOCATED 释放没有被分配的数组
不能用非常量代替定义数组的上下界。
FORTRAN 90 程序编程规范 Fortran 90 编程规范,使程序代码高度组织化,更加易读、易懂、易于维护,程序更加高效。使编出的程序更易懂、易于维护。 1 语言选择 数值预报创新系统软件开发应避免使用Fortran77 的某些过时特征以Fortran 90不一致的特征。选择Fortran 90 作为开发语言,并采用Fortran 90 的新功能,如动态内存的分配(dynamic memory allocation)、递归(recursion ), 模块(modules)、POINTER 、长变量名、自由格式等。 Fortran 77其中某些只是一些冗余的功能,这些功能已经过时,另外,还有一些在Fortran90 中被证明是不好的用法,建议不要使用。 2 Fortran 90 的新特性 2.1.1 建议使用的Fortran 90 新特性 建议使用Fortran 90 提供的模块(module ),并用Use ONLY 指定module 中哪些变量或派生类型定义可用于调用程序。 尽量使用数组下标三元组,这样可优化并减少所需的代码行数。为提高可读性,要在括号内表明数组的维数,例如: 1dArrayA(:) = 1dArrayB(:) + 1dArrayC(:) 2dArray(: , :) = scalar * Another2dArray(: , :) 当访问数组的子集时,例如在有限差分等式中,可以通过使用下标三元组实现。例如:2dArray(: , 2:len2) = scalar *( & Another2dArray(:, 1:len2 -1) & - Another2dArray(:, 2:len2) & ) 对程序单元(program units )命名,并使用End program ,End subroutine ,End interface ,End module 等结构再次指定“program unit ”的名称。 在逻辑表达式中使用>、 >=、 ==、 <、 <=、 /=,它们分别代 替.gt.、.ge.、.eq.、.lt.、.le.、.ne. 。新的表示方法更接近标准的数学符号 在变量定义中始终使用“::”;始终用“DIMENSION ”定义数组形状;始终用(len=)的语法格式声明字符变量的长度。
FORTRAN程序设计复习题 选择题 B (1)下列各FORTRAN表达式中合法的是 A) S+T*2P >= 0.0 B) .NOT. (A*B+C) C) A2+B2/(C+D) <= 0.0 D) (A+B).NOT.A*B.GT.0.0(.NOT.只跟一个表达式) C (2)数学式(3/5)ex+y的FORTRAN表达式是 A) 3*EXP(X+Y)/5 B) 3*E* *(X+Y)/5.0 C) (3/5)*EXP(X+Y) D) (3.0/5.0)EXP(X+Y) D (3)下列FORTRAN77表达式中不合法的是 A) A.GT.B.EQV.C.GT.D B) A.AND.B.AND.C.AND.D C) .NOT.(X.LE.0.0) D) A.LT.B.LT.C.LT.D D (4)下列叙述中不正确的是 A) FORTRAN子程序可以单独编译 B) 对一个FORTRAN源程序进行编译和连接无误后可生成可执行文件 C) 即使编译和连接都正确无误,FORTRAN程序运行时仍可能出错 D) FORTRAN连接的主要任务是把函数库中的函数翻译成机器指令(主要任务为连接目标文件) B (5)在下列FORTRAN77运算符中,优先级最高的是 A) .AND. B) .NOT. C) .OR. D) .EQ. B (6)FORTRAN表达式"6/5+9/2**3/2"的值为 A) 33 B) 1 C) 5 D) 3 A (7)下列FORTRAN77 表达式中,合法的是:A)相当于0.0.LE.X .AND.(.NOT.(X.GE.10.0 ))A) 0.0.LE.X .AND..NOT.X.GE.10.0 B) 0.0.GE.X.LT.10.0 C) 0.0.LE.X.GE.10. D) 10.0.LE.X.OR..AND.X.GT.0.0 D (8)关于编译一个FORTRAN源程序文件,下列说法中错误的是 A) 允许编译只有一个主程序而没有子程序的源文件 B) 允许编译有多个子程序的源文件 C) 允许编译只有一个子程序而没有主程序的源文件 D) 允许编译有多个主程序的源文件 C (9)在FORTRAN77源程序中,续行标志符必须放在 A) 第1列 B) 第1-6列 C) 第6列 D) 第5列 D (10)下列关于"SUBROUTIN E MAP(X,Y)"语句行的叙述中,不正确的是 A) 这是子程序的第一个语句 B) 字符串"MAP"是子程序名 C) 变量X是子程序的形参 D) 子程序执行后,MAP将返回整型数据(子程序无返回值,自定义函数才有) A (11)FORTRAN表达式"2/4+0.5"的值是 A) 0.5 B) 1 C) 1.0 D) 0 D (12)FORTRAN表达式"MOD(4.9,1.3)"的值是 A)1.3 B)0.0 C)4.9 D)1.0 A (13下列FORTRAN运算符中,优先级最低的是 A)逻辑运算符.AND. B)算术运算符* C)关系运算符 >= D)算术运算符+ A (14下列语句函数的定义中正确的是 A)F(X,Y)=(X+Y)/(X*Y)+7.0 B)FUNCTION FUN(I,J,K)=3*I+2*J+0.5*K
一些免费的fortran编译器 https://www.doczj.com/doc/919788159.html,/node/8 Free Fortran Compilers 取自https://www.doczj.com/doc/919788159.html,/compilers/fortran.shtml This page lists free Fortran compilers for various operating systems. Some of the compilers are compliant with the ANSI Fortran 77 specifications, others with Fortran 95, and so on. Some of them may also come complete with debuggers, editors and an integrated development environment (IDE). If you need a book on Fortran, you may want to check out the selection of books available at https://www.doczj.com/doc/919788159.html,. Disclaimer The information provided on this page comes without any warranty whatsoever. Use it at your own risk. Just because a program, book or service is listed here or has a good review does not mean that I endorse or approve of the program or of any of its contents. All the other standard disclaimers also apply. Free Fortran Compilers and IDEs Sun Studio Compilers and Tools Sun Studio Compilers and Tools for Linux and Solaris OS on Sparc and x86/x64 platforms includes command line tools as well as a NetBeans-based IDE for developing, compiling and debugging C, C++ and Fortran programs. It also includes performance analysis tools. Intel Fortran Compiler for Linux
1.Fibonacci数列定义如下: F1=1 F2=1 F n=F n-1+F n-2 (n>2) 求Fibonacci数列的前30项。 integer f(30),i f(1)=1 f(2)=2 do i=3,30 f(i)=f(i-1)+f(i-2) enddo print*,f end 2.输入10个学生的总分,求每个学生的名次integer s(10),a(10),i,j do i=1,10 read*,s(i) enddo do i=1,10 a(i)=1 do j=1,10 if(s(i)