改程序中出现的问题
源程序很简单的依据:DO I=NLAYER,1,-1我需要加些判定条件,大概改成这个意思:
IF(FDTNLAYER.GT.0.AND. FDTNLAYER .LT.NLAYER)THEN DO I=NLAYER,FDTNLAYER,-1 IF(fDTNLAYER.EQ.NLAYER)THEN 不循环IF(TDTNLAYER.GT.0 .AND.TDTNLAYER.LT.NLAYER) then DO I=TDTNLAYER,1,-1 IF(TDTNLAYER.EQ.NLAYER)THEN DO 51 I = NLAYER,1, -1
改成一个这样的程序要怎么改呢?
If (fdtnlayer>0 .And. fdtnlayer<nlayer) Then
iBegin = nLayer
iEnd = fdtnLayer
iStep= -1
Else If (fdtnlayer==nlayer) Then
iBegin = 1
iEnd = 0 !// 结束小于开始,则不循环
iStep= 1
Else If (tdtnlayer>0 .And. tdtnlayer<nlayer) Then
iBegin =tdtnLayer
iEnd = 1
iStep= -1
Else If (tdtnlayer==nlayer) Then
iBegin = nLayer
iEnd = 1
iStep= -1
End If
Do i = iBegin , iEnd , iStep
...
End Do fcode 发表于 2015-4-17 10:33
If (fdtnlayer>0 .And. fdtnlayer0 .And. tdtnlayer
错误 1 error #8093: A do-variable within a DO body shall not appear in a variable definition context. C:\B90Vdongtu\FOR\B90.FOR 510
出现了好几个这样的错误,这是怎么回事呢? 就是会出现截图里面的情况,以前也没见过啊 这需要代码才能判断。 renlu617 发表于 2015-4-17 11:17
错误 1 error #8093: A do-variable within a DO body shall not appear in a variable definition cont ...
fcode 给你的是以f90的自由格式写的,而你用的后缀是FOR,编译器就是以f77的固定格式来编译,自然会抱错。 renlu617 发表于 2015-4-17 11:28
就是会出现截图里面的情况,以前也没见过啊
f77的固定格式中,doenddo的格式是没有的。
页:
[1]