爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3261|回复: 4

[求助] fortran的if语句

[复制链接]

新浪微博达人勋

发表于 2015-9-24 11:18:41 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
各位路过的大神们,请问          IF(X)10,20,3010      CALL PTF(P,T,V,H,S)
        GOTO 40
30      CALL PTG(P,T,V,H,S)
        IF(X.GE.1.0) GOTO 40
        X=X+1.0
        GOTO 40
20      WRITE(*,*)'***BE SATURATED STTE***'
40      RETURN
        END
这段程序里面,IF(X)10,20,30是什么意思?


密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-9-24 12:14:27 | 显示全部楼层
旧Fortran的写法 后面的都是语句标号 if(x)为真则执行前边标有10,20,30的语句
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 成长值: 19710
发表于 2015-9-24 13:34:02 | 显示全部楼层
Arithmetic IF Statement
The arithmetic IF statement conditionally transfers control to one of three statements, based on the value of an arithmetic expression. It is an obsolescent feature in Fortran 95 and Fortran 90.
The arithmetic IF statement takes the following form:
IF (expr) label1, label2, label3

expr
Is a scalar numeric expression of type integer or real (enclosed in parentheses).

label1, label2, label3
Are the labels of valid branch target statements that are in the same scoping unit as the arithmetic IF statement.
Rules and Behavior
All three labels are required, but they do not need to refer to three different statements. The same label can appear more than once in the same arithmetic IF statement.
During execution, the expression is evaluated first. Depending on the value of the expression, control is then transferred as follows:
If the Value of expr is:
Control Transfers To:
Less than 0 Statement label1
Equal to 0 Statement label2
Greater than 0 Statement label3
Examples
The following example transfers control to statement 50 if the real variable THETA is less than or equal to the real variable CHI. Control passes to statement 100 only if THETA is greater than CHI.
IF (THETA-CHI) 50,50,100
The following example transfers control to statement 40 if the value of the integer variable NUMBER is even. It transfers control to statement 20 if the value is odd.
IF (NUMBER / 2*2 - NUMBER) 20,40,20
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2015-9-24 14:40:59 | 显示全部楼层
谢谢大家的帮助!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-9-24 23:36:39 | 显示全部楼层
也来学学了,谢谢
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表