主题:这个IF句是不是有问题?
liqiang12003
[专家分:0] 发布于 2010-09-20 20:41:00
。。。
C NP为结点总数
DO 30 I=1,NP
DO 30 J=1,2
IF(JR(J,I)) 30,30,25
25 N=N+1
JR(J,I)=N
30 CONTINUE
。。。
这里,这个IF句是不是个病句啊? 30,30,25怎么看不懂呢?
回复列表 (共4个回复)
沙发
asymptotic [专家分:16630] 发布于 2010-09-20 20:47:00
IF - Arithmetic
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.
Syntax
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 IFstatement.
板凳
liqiang12003 [专家分:0] 发布于 2010-09-20 21:00:00
这是什么意思呢? 有效地分支范围?
这表示什么呢?
3 楼
liqiang12003 [专家分:0] 发布于 2010-09-20 21:04:00
看到你的这篇回帖了,不用你再说了,懂了。谢谢牛人!
IF - Arithmetic
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.
Syntax
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 IFstatement.
Description
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
Example
The following example transfers control to statement 50 if the real variable THETAis less than or equal to the real variable CHI. Control passes to statement 100 only if THETAis greater than CHI.
IF (THETA-CHI) 50,50,100The following example transfers control to statement 40 if the value of the integer variable NUMBERis even. It transfers control to statement 20 if the value is odd.
IF (NUMBER / 2*2 - NUMBER) 20,40,20The following statement transfers control to statement 10 for n < 10, to statement 20 for n = 10, and to statement 30 for n > 10:
IF (n-10) 10, 20, 30The following statement transfers control to statement 10 if n <= 10, and to statement 30 for n > 10:
IF (n-10) 10, 10, 30
4 楼
cgl_lgs [专家分:21040] 发布于 2010-09-20 21:06:00
小于0,等于0,大于0,三種狀態對應三個GOTO。
我来回复